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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :

Paging in Query X++ Dynamics 365 for finance and operations

Ali Zaidi Profile Picture Ali Zaidi 4,657

For paging in X++ Query. There are three steps required. Rest of Query Code is same.

We have to set following things in Query data source

  • Set Sort field in Query data Source.
  • Paging position property of QueryRun is set to true.
  • Add page range with starting position and number of records in QueryRun

Here is code snippet

 

  QueryBuildRange qbr,qbrStartDate,qbrEndDate;
QueryBuildDataSource qbd;
IAPageSize EnumPageSize;

QueryRun        qr;

Query           query = new Query();

Int pageSize = 2;

 

qbd = query.addDataSource(TableNum(ProjPlanVersion));
qbd.addOrderByField(fieldNum(ProjPlanVersion,HierarchyId));

qr = new QueryRun(query);

qr.enablePositionPaging(true);
            CurrentPageNumber =1;
            startingposition = CurrentPageNumber * pagesize;
            qr.addPageRange(startingposition, totalRows);
while(qr.next())

 

{

 

Info (“”);

}

Comments

*This post is locked for comments