Fetch number of records in a FormDataSource (e.g. of a Grid)

SysQuery::getTotal works fine, but the trick is how to handle temporary data sources where getTotal does not work:

if(!formDataSource.curser().isTmp())
{
    recordCount = SysQuery::getTotal(formDataSource.queryRun());
}
else
{
    while(!formDataSource.allRowsLoaded())
    {
        formDataSource.getNext();
    }
    recordCount = formDataSource.numberOfRowsLoaded();
}

Now recordCount contains the number of Records in the FormDataSource irrespective of the Tmp status of the data source. Of course the whole tmp-data source has been loaded in the process, which might be an issue in some cases.


Posted

in

by

Comments

One response to “Fetch number of records in a FormDataSource (e.g. of a Grid)”

  1. […] Records in Student Datasource %1",SysQuery::countTotal(queryRun)));}Further you can refer this post to retrieve the rows from the temporary data source as well. Read Complete Post and […]

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.