Friday, August 24, 2007

Getting number of recrods present in a query run

Scenario: I want to get the total number of records from a query run object. I will use them to generate a progress bar (progress indication framework).

Answer: Use SysQuery::countloop(qr). this will return the total number of records in a query object.

3 comments:

  1. Very usefull, i used it in my feature and it works!! :)

    ReplyDelete
  2. Just be very careful, when you have QueryRun with more then one dataSource. In this case this method will count records really uneffective, he will move trough whole QueryRun one by one.

    Regards

    ReplyDelete
  3. I think the correct method to get the number of records is SysQuery::countTotal().

    ReplyDelete