Here is the code illustrating how to get Ranges / Criteria from the run_time query dialog
static void Query_getRanges(Args _args)
{
Query query = new Query();QueryRun queryRun;
QueryBuildDataSource qbd;
CustTable custTable;
QueryBuildRange range;
int cnt, i;
;
qbd = query.addDataSource(tablenum(CustTable));
queryRun = new QueryRun(query);
queryRun.prompt(); // To Prompt the dialog
cnt = queryRun.query().dataSourceTable(tablenum(CustTable)).rangeCount(); // number of ranges in Query
info(strfmt("Total Records in Query %1",SysQuery::countTotal(queryRun))); // number of records in Query
// showing query description
for (i=1 ; i<=cnt; i++)
{
range = queryRun.query().dataSourceTable(tablenum(CustTable)).range(i);
info(strfmt("Range Field %1, Value %2",range.AOTname(),range.value()));
}
//showing data from the datasource according to the query
while (queryRun.next())
{
custTable = queryRun.get(tablenum(CustTable));
info(strfmt("Customer %1, Name %2",custTable.AccountNum, custTable.Name));
}
}
Aucun commentaire:
Enregistrer un commentaire