If your query has just one datasource you can use SysQuery::countTotal
static void CountProjTableRecords(Args _args)
{
Query query = new Query();
QueryRun queryRun;
QueryBuildDataSource qbd;
qbd = query.addDataSource(tablenum(ProjTable));
queryRun = new QueryRun(query);
info(strfmt("Total Records in Query %1", SysQuery::countTotal(queryRun))); // total records 1130
}
If we need to count number of records of a query with more than one datasource, you must use SysQuery::CountLoops(QueryRun).
static void CountProjTableRecords(Args _args)
{
Query query = new Query();
QueryRun queryRun;
QueryBuildDataSource qbds, qbds1;
qbds = query.addDataSource(tablenum(ProjTable));
qbds1 = query.addDataSource(tablenum(ProjTable)).addDataSource(tablenum(ProjForecastTable));
queryRun = new QueryRun(query);
info(strfmt("Total Records in Query %1", SysQuery::countLoops(queryRun)));
}
Comments
Post a Comment