Error in RDP report controller class

Hi,

I have created an RDP based report as follows:

[
SRSReportQueryAttribute(queryStr(TestLedgerJournalTable))
]
class TestDp extends SRSReportDataProviderBase
{
TestTmp testTmp;

}

I am running the report through controller class and written the following code in the prePromptModifyContract method.

protected void prePromptModifyContract()
{
LedgerJournalTable jourTable;
Query query;
QueryBuildDataSource qbds;

jourTable = args ? args.record() as LedgerJournalTable : null;

if(jourTable.RecId)
{
query = this.getFirstQuery();
qbds = query.dataSourceTable(tableNum(LedgerJournalTable));
qbds.addRange(fieldNum(LedgerJournalTable, JournalNum)).value(jourTable.JournalNum);

}
}

When I run the report, this.getFirstQuery() returns null and I am getting error “Query object not initialized.” in the line:

qbds = query.dataSourceTable(tableNum(LedgerJournalTable));

I do not need additional parameters, so I didn’t create any contract class for the report.

Please advise what I am missing or doing wrong.

Rgds,

Nagesh

You need to intialize the object.

I suspect query is not initialized in “query = this.getFirstQuery()”

Nevertheless, you won’t comment your own script unless enough details provided.

Hi Krishna,

I have created a query which I have already associated with the RDP class using the SRSReportQueryAttribute. Now I am unable to get where else this initialization has to be done.

Please let me know if you need some additional information from my side.

Best Regards,

Nagesh

replace query = this.getFirstQuery() with

query = this.parmReportContract().parmQueryContracts().lookup(this.getFirstQueryContractKey())

Hi Krishna,

still the above solution not working. It is giving error “Map object not initialized”.

Rgds,

Nagesh

AT which place the error is coming, Ensure that query has interaction for changing ranges at run time. And also have a try from your side instead of saying Not working someone’s solution.

Hi Krishna,

What I meant was I tried the above solution as well, but still I am getting error. Sorry that you are taking it as personal but my intent was not to hurt you or to put a blame on your solution. It was just a query and nothing more than that. If you feel hurted by my words, them I really apologize for that once again.

I am thankful to you that you paid attention to my query and tried to provide a solution to the same.

Thanks,

Nagesh

Despite that, open report in Visual studio and check
Dataset → Properties → Dynamic filters .
let us know what it has True or false

Hi Nagesh, Can you post the error message you are facing ?

I think this is a cache issue which I faced in the recent times. Place a breakpoint and try to debug from where it is originating

Hi Nash,

Thanks for the reply. In the prePromptModifyContract of the controller class, when I Write the code query = this.getFirstQuery(), I get the error “Query object not initialised”. When I change it to “query = this.parmReportContract().parmQueryContracts().lookup(this.getFirstQueryContractKey());” I get the error Map object not initialized. I have tried by changing the Dynamic filters to true/false in visual studio, cleaning the cache and deleting the records from the table SRSReportQuery, restarting the reporting services, but it didn’t work at all.

I have not created any contract class, as I didn’t need any parameter for filtering.

Please advise.

Best Regards,

Nagesh

Make Dynamic filters - True & keep
query = this.parmReportContract().parmQueryContracts().lookup(this.getFirstQueryContractKey());
refresh dataset and redeploy