web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

How to fetch number of records in datasource in Dynamics AX

Shankar Das Profile Picture Shankar Das 205
I am going to share through post that sometimes we need to retrieve the number of records in a particular datasource. Let's say we have two datasources in a form named Student and StudentCourseEnrollment.

I simply need to fetch the number of records in Student Datasource in the init event of the the form. I would require following peace of code for that.


public void init()
{
    QueryRun queryRun;

    super();

    queryRun = new QueryRun(Student_ds.query());


    info(strfmt("Total 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.

This was originally posted here.

Comments

*This post is locked for comments