First we need to find the datasource where we want to apply the range. Query.datasourceTable provides the reference of a querybuilddatasource. After getting the reference we can use the addRange method to add range and value in it.
Here's the demo. CustTable is a query object exist in AOT. No range is applied in a AOT query object, here the range is applied on a accountnum field of CustTable.
Query query = new Query(querystr(CustTable));
QueryRun queryRun;
QueryBuildDataSource queryBuildDataSource;
CustTable custTable;
//finding the reference of datasource.
queryBuildDataSource = query.dataSourceTable(tablenum(CustTable));
//adding range and providing the value for the range.
queryBuildDataSource.addRange(fieldnum(CustTable, AccountNum)).value('4000');
queryRun = new QueryRun(query);
while(queryRun.next())
{
custTable = queryRun.get(tablenum(CustTable));
info(strfmt('%1 ', custTable.AccountNum));
}
No comments:
Post a Comment