我有一组需要分组到多个级别的数据。例如:
Group 1
Group 2
Line 1 Aggregated data
Line 2 Aggregated data
Totals for Group 2
Group 3
Line 3 Aggregated data
Line 4 Aggregated data
Line 5 Aggregated data
Totals for Group 3
Line 6 Aggregated data
Totals for Group 1
Group 4
Line 7 Aggregated data
Line 8 Aggregated data
Totals for Group 4
正如您所希望的那样,第1组由另外两个组组成,但也有一个类别(第6行)直接包含在第1组中。这种分组的主要原因是各种小计将出现在报告中的正确位置。
我创建了一个类似的报告,其中所有订单项都是两个级别,这很容易。我在使用此报告时遇到问题,因为数据级别各不相同。我查看了分层组,但我发现的所有示例都有相同项的层次结构(通常是Employee-> Manager层次结构,其中每个级别都是员工)。在这种情况下,尽管这些组本身只是没有实际数据的容器,但是这里的层次结构似乎不起作用。
我可以访问数据和返回它的代码,所以如果有一个解决方案涉及以某种方式返回数据,那么我可能会这样做。
数据表目前看起来像这样:
Lines-<Accounts (Each line item is made up of data from multiple accounts)
Groups-<Lines (Each line item is contained in a group)
Groups-Groups (Each group might be contained in a parent group - which then might further be contained in another group)
AccountBalances
AccountCode Month Amount
00001 201701 100.00
00001 201702 150.00
00002 201701 110.00
....
Lines
LineName GroupName
Agency Commission Commissions
Direct Commission Commissions
Sales Income
LineMapping
LineName AccountCode
Agency Commission 00001
Agency Commission 00002
Direct Commission 00003
Direct Commission 00004
Direct Commission 00005
....
Groups
GroupCode ParentGroupCode
Income NULL
Commissions Income
Other Income Income
Sales Expense Expense
非常感谢任何建议!