Example of Fetch method of report using query build data source in MSD axapta

This is a code to get details of table data which is added to report data source. You can add following code in fetch method of report to check how to get value of data you can add range in data source and get the filtered records from report.

 Query q;  
 QueryRun qr;  
 QueryBuildDatasource qbds;  
 QueryBuildRange qbr;  
 ;  
 q = this.Query();  
 qr = new QueryRun(q);  
 QBDS = QR.query().dataSourceNo(1);  
 while(qr.next())  
 {  
 inventtable = qr.get(tableNum(InventTable));  
 info(inventtable.ItemGroupId);  
 }