question about filter the SSRS report data

Hi Gurus.

i developed a SSRS report and related artifacts as below:

  1. Query (contains one table GeneralJournalEntry)

  2. CustomerController (extends the SrsReportRunController)

  3. SSRS Report (which use the query defined above)

the report data set is based on the query and the property “Dynamic Filters” is “False”. now i created a menu item and link to the custom controller class.

once the report open all the data is rendered.

my question:

is it possible for me to filter the data by custom code in the controller ?

if so ,can you guys share a code snippet ?

many thanks.

You just have to overwrite the prePromptModifyContract() method on the report controller class.

Here is an example of code for prePromptModifyContract() method which checks if there were any args passed through the menu item button (a datasource arg). And if there was a current buffer, then based on the record data the main query of the report will be modified - a new range for InvoiceAccount will be set up.

protected void prePromptModifyContract()
{
Query myQuery;
CustTable custTableBuffer;
;

if (this.parmArgs() &&
this.parmArgs().record() &&
this.parmArgs().dataset() == tableNum(CustTable))
{
custTableBuffer = this.parmArgs().record();

myQuery = this.parmReportContract().parmQueryContracts().lookup(this.getFirstQueryContractKey());
if (myQuery)
{
myQuery.dataSourceTable(tableNum(CustInvoiceJour)).clearRanges();
myQuery.dataSourceTable(tableNum(CustInvoiceJour)).addRange(fieldNum(CustInvoiceJour, InvoiceAccount)).value(custTableBuffer.AccountNum);
}
}

super();
}

Don’t forget to choose the datasource to be passed on the menu item button.

HI Tiwari, thanks for your reply,

i tried to override this method,in this method, i tried to get the query by following expression,

query = this.getFirstQuery()

the query is null.

Query bounded to report is correct ? Verify it once.

GetFirstQuery

Hi Tiwari,

What do you mean “Query bounded to report” ? my report dataset is based on the query, anywhere else i have to bound the query again ?