Error: Query object not initialized.


I have a SSRS Report using RDP(temporary table). i use the Query Attribute [SRSReportQueryAttribute(queryStr(PlatformQuery))] and have processReport() to generate dataset for the report.

I have this error arise in the prePromptModifyContract(),

Query qry = this.getFirstQuery();

QueryBuildDataSource queryBuildDataSource;

QueryBuildRange qbrRequestNumber;

platform = args.record();


qry.dataSourceTable(tableNum(Platform_Detail)).clearRanges();//// error thrown here by qry

queryBuildDataSource = qry.dataSourceTable(tableNum(Platform_Detail));

qbrRequestNumber = queryBuildDataSource.addRange(fieldNum(Platform_Detail,Plat_ID));

I am using AX 2012 R3, reply if u have any suggestions…

Thank u…

If I understand the code correctly, the problem is already on the first line (this.getFirstQuery() doesn’t return any query), correct?

(Question moved from the Technical forum.)

Thanks for reply,

I think the problem is, I have added the QueryAttribute after the report is deployed. it didn’t work after re-deployment also. So, i have to repeat the step to create the SSRS report from the sketch, Now it works fine.

Does the SSRS report needs to be re-created from the scratch when QueryAttrib is added before deploying it to AOT? Please advise. Thanks

You don’t have to. But please explain your case in detail (may be in a separate post). The one you are trying to reply is two year old post.

Actually, I have the same error.

When I run the report, it says: Error: Query object not initialized. And it points to prePromptModifyContract() method.

have you tried by refreshing the data set on the report?