Saturday, 30 July 2016

Filtering Data On SSRS Query

Hi,
Below is the sample code written to filter the data based on Query used by report and apply on custom query in DP class;

//DP class
queryVendInvoiceJour=this.parmQuery();
//Get filtered/selected value from standard query
qrOrderAccount = queryVendInvoiceJour.dataSourceName(‘VendInvoiceJour’).rangeField(fieldNum(VendInvoiceJour,OrderAccount));
//Writing custom query based on requirement but applying the selected ranges to custom query
q=new Query();
qbdsVendInvoiceJour = q.addDataSource(tablenum(VendTrans));
qrVendInvoiceJour = qbdsVendInvoiceJour.addRange(fieldNum(VendTrans,AccountNum));
q.dataSourceNo(1).rangeField(fieldNum(VendTrans,AccountNum)).value(qrOrderAccount.value());
qr = new QueryRun(q);

This will help to overwrite the Query used in Report using the custom query by applying same ranges selected by user.

No comments:

Post a Comment