How to group by a common table with a specific field?
I'm getting a syntax error on (dt.fieldname2Id('BatchNo'))
Here's my code:
Common common;
SysDictTable dt;
dt = SysDictTable::newName('Table1');
common = dt.makeRecord();
while select count(RecId) from common
group by common.(dt.fieldname2Id('BatchNo')) //syntax Error here
where common.(dt.fieldname2Id('flag'))==1
{
info(int642str(Common.Recid));
}
You can use Query
instead:
Common common;
SysDictTable dt;
Query query = new Query();
QueryBuildDataSource qbds;
QueryRun queryRun;
dt = SysDictTable::newName('SalesTable');
common = dt.makeRecord();
qbds = query.addDataSource(common.TableId);
qbds.addGroupByField(dt.fieldname2Id('CustAccount'));
queryRun = new QueryRun(query);
while (queryRun.next())
{
...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.