我在报告的 init() 中有以下代码:
QueryBuildDataSource qbdsTable;
QueryOrderByField QueryOrderByFieldTransDate;
QueryOrderByField QueryOrderByFieldDimZone
QueryOrderByField QueryOrderByFieldDimCC;
;
super();
qbdsTable = query.dataSourceTable(tableNum(Table));
QueryOrderByFieldTransDate = qbdsTable.addOrderByField(fieldNum(Table, TransDate));
QueryOrderByFieldTransDate.autoSum(true);
QueryOrderByFieldDimZone = qbdsTable.addOrderByField(fieldNum(Table, DimZone),SortOrder::Descending);
QueryOrderByFieldDimZone.autoSum(true);
QueryOrderByFieldDimCC = qbdsTable.addOrderByField(fieldNum(Table, DimCostCenter));
QueryOrderByFieldDimCC.autoSum(true);
并且 autosum 属性运行正常(我已经为用于计算这些小计的字段设置了 SumAll 属性)。
问题是,每当我尝试添加 groupBy 字段或选择字段时, autosum 属性不再受支持(不再显示小计):
qbdsTable.addSelectionField(fieldNum(Table, AmountMST), selectionField::Sum);
或者
qbdsTable.addGroupByField(fieldNum(Table, TransDate));
我曾尝试使用:
qbdsTable.addSortField(fieldNum(Table, TransDate));
qbdsTable.autoHeader(1, true);
但我有同样的问题
有谁知道如何在报告的同一个数据源上同时使用 autosum 和 addGroupByField ?