Static void Job1()
{
Query query = new Query();
QueryBuildDataSource qbds1;
QueryBuildRange qbr;
SysTableLookup sysTableLookup;
sysTableLookup = sysTableLookup::newParameters(tablenum(InventTable),this);
sysTableLookup.addLookupfield(fieldnum(InventTable,ItemId));
sysTableLookup.addLookupfield(fieldNum(InventTable,ItemId));
qbds1 = query.addDataSource(tableNum(InventTable));
qbds1.addGroupByField(fieldNum(InventTable,ItemId));
qbds1.orderMode(OrderMode::GroupBy);
sysTableLookup.parmQuery(query);
sysTableLookup.parmUseLookupValue(False);
sysTableLookup.performFormLookup();
}