Counting the number of records in a QueryRun

  • March 9, 2010
  • 0 Comments

When you want to count the number of records that are currently displayed on a form, and you have only one data source, just call the static method countTotal() from the SysQuery-class.

public void executeQuery()
{
    ;
    super();
    info(int2str(SysQuery::countTotal(EmplTable_ds.queryRun())));
}

But when you want to do the same when you joined multiple data sources, you will actually have to loop trough the whole selection. You can do this easily by calling countLoops() on the SysQuery-class. Keep in mind that this has a serious influence on your performance.

public void executeQuery()
{
    ;
    super();
    info(int2str(SysQuery::countLoops(EmplTable_ds.queryRun())));
}