You can use the following code:
QueryBuildFieldList qbfl = qbds.fields();
qbds = q.addDataSource(tablenum(SalesLine));
//QBFL
qbfl.addField(fieldNum(SalesLine,SalesQty),SelectionField::Sum);
qbds.addSortField(fieldnum(SalesLine,ItemId));
qbds.orderMode(OrderMode::GroupBy);
qr = new QueryRun(q);
while(qr.next())
{
salesLine = qr.get(tablenum(SalesLine));
info(strfmt('Item Id =%1, Qty = %2',salesLine.ItemId,salesLine.SalesQty));
}
Tidak ada komentar:
Posting Komentar