Filtering data in SSRS Query


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


//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));

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.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s