Hi,
Below is the code snipet to find out the MAX value of a particular field in a particular table.
static void MaxValueTest(Args _args)
{
str maxValue(TableId tableId, FieldId fieldId)
{
QueryRun qr = new QueryRun(new Query());
qr.query().addDataSource(tableId).addSelectionField(fieldId, SelectionField::Max);
return qr.next() ? any2str(qr.get(tableId).(fieldId)) : '';
}
;
info(maxValue(tableNum(BOMTable), fieldNum(BOMTable,BOMId)));
}
In the above example the "SlecttionField" has the mulitple static filed which can give you more choices.
Thanks,
/Ashlesh