Sunday, April 26, 2009

Number of records in a form

Have you ever needed the number of rows that are returned by the executeQuery method on the datasource of a form? For example to show some progress display while you evaluate each record individually?



Not available in earlier versions of Dynamics Ax aka Axapta, but now it is:



yourdatasource_ds.numberOfRowsLoaded();



Easier then doing a select count statement, not?

(The MSDN help information (Ax 2009 SDK) is rather limited for this function.)


Greetings,



Willy.

1 comment:

  1. Hi,

    i just try it and think you get not the number of queryrecords. Only number of cached records returned.
    I use SysQuery::countTotal(My_ds.queryRun()) to get number of records.

    Here you found discussion about this:
    http://www.eggheadcafe.com/conversation.aspx?messageid=32657608&threadid=32657605

    Best regards
    Michael

    ReplyDelete