我有一个看起来像这样的数据
| FormCode | Description | MenuPath |
+----------+----------------------+-------------+
| PY | Payroll | |
| PD | Personal Development | |
| EM | EmployeeMaster | PY |
| EB | EmployeeBank | PY |
| ED | EmployeeData | PY |
| Report | Report | PY |
| Badge | Badge Report | PY/Report |
| Process | Process | PY |
| Bonus | Bonus Component | PY/ED |
|Preference| Preference | PY |
| Tax | Tax Result | PY/ED |
|FinalBonus| FinalBonus | PY/ED/Bonus |
| Annual | Annual Process | PY/Process |
|BonusbyCC | Bonus by Cost Centre | PY/ED/Bonus |
| Period | Period |PY/Preference|
我希望这个数据排序如下所示。
| FormCode | Description | MenuPath |
+----------+----------------------+-------------+
| PY | Payroll | |
| EB | EmployeeBank | PY |
| ED | EmployeeData | PY |
| Bonus | Bonus Component | PY/ED |
|BonusbyCC | Bonus by Cost Centre | PY/ED/Bonus |
|FinalBonus| FinalBonus | PY/ED/Bonus |
| Tax | Tax Result | PY/ED |
| EM | EmployeeMaster | PY |
|Preference| Preference | PY |
| Period | Period |PY/Preference|
| Process | Process | PY |
| Annual | Annual Process | PY/Process |
| Report | Report | PY |
| Badge | Badge Report | PY/Report |
| PD | Personal Development | |
这是排序的结果
Explanation :
我将尝试解释排序。首先我们看一下formcode。它会将 PY 放在第一行。之后,将出现 MenuPath 为 PY 的行(按描述中的字母排序)。在这种情况下,EmployeeBank 首先显示。如果它没有任何子路径,则下一行将是 EmployeeData。之后,EmployeeData 有了一个孩子,我们可以看到下一行有 Bonus Component(sort by Description)。之后,如果没有子项,则下一行将是 Tax Result,但正如您所见,Bonus Component 仍然有一个子项(Bonus by Cost Center 和 FinalBonus),因此这 2 个数据将出现在 Bonus Component 之后。税务结果将出现在下一个。该过程将保持这种状态,直到数据结束。
对不起,如果我的英语搞砸了,我的解释也不好。如果有人理解我的意思并且可以在解释上修正我的英语,请这样做
谢谢您的帮助