我想计算CustTable中的记录数(按CustGroup分组),并使用查询代码对每个custgroup中的记录数进行排序。
这是我的代码:
q = new Query();
queryBuildDataSource = q.addDataSource(tableNum(custTable));
queryBuildDataSource.addGroupByField(fieldNum(custTable, CustGroup));
//queryBuildDataSource.addSortField(fieldNum(custTable, count(RecId), SortOrder::Descending));
qr = new QueryRun(q);
while(qr.next())
{
custTable = qr.get(tableNum(custTable));
info(strFmt("%1 --- %2", custTable.CustGroup, custTable.RecId));
}
我知道'计数'在这里不起作用......我该如何解决?