Question Status

Verified
Benoit Cyr asked a question on 6 Nov 2012 12:04 PM

Hi ,

How can I run (call)  a SSRSreport from a method in X++.

Thanks.

Reply
Verified Answer
Daniel Weichsel responded on 6 Nov 2012 1:56 PM

You can use the SrsReportRunController class as in this example:

   SrsReportRunController  controller;

   controller = new SrsReportRunController();

   controller.parmReportName(ssrsReportStr(LedgerTrialBalance, Summary));

   controller.startOperation();

The controller has additional parm methods to help control running the report, such as parmShowDialog which you can use to skip the report dialog.

For advanced features you can create a new controller class extending SrsReportRunController and override methods.  For example, by overriding the prePromptModifyContract method you can manipulate the query or other data members before the dialog is shown.

Reply
Benoit Cyr responded on 7 Nov 2012 5:18 AM

Thanks Daniel,

It's working.

Case closed.

Reply
Zahir Hussan responded on 12 Feb 2013 4:10 AM

Hi,

       I need to know the usage of controller class in ax 2012 for creating SSRS Report.

       Any ideas, Please share it.

Regards,

Zahir

Reply
venkatesh vadlamani responded on 12 Feb 2013 7:41 AM

Report programming model for Microsoft Dynamics AX 2012

search for above text in BING.

MOst comprehensive documentation for reporting framework in ax 2012

Reply
Ante Karpuzovski responded on 13 Feb 2013 6:15 AM

How can I run the report with parameters?

Reply
venkatesh vadlamani responded on 13 Feb 2013 10:06 AM

you have to get the contract object associated to the execution by using this kind of construct

ReportContractClass contract;

contract = controlerObj.ParmReportContract().ParmRDPContract() as ReportContractClass

contract.parmParamete1(SetValueHere)

contract.parmParameter2(SetValuehere);

now call this method,

ControlerObj.startOperations()

Reply
Ante Karpuzovski responded on 15 Feb 2013 2:11 AM

With parameters like calling the report with parameter name Customer_Num, Invoice_ID...,  not report parameters like print destination, report name, caption... ?

Reply
venkatesh vadlamani responded on 15 Feb 2013 2:26 AM

@ Ante    

You need to first set the report name for the controller object

then you get the ReportContract object from it as mentioned above.

ReportContractContains

1)RDPContract   (If you have a DP class attached to a DS used in the report which has a parameters)

2)RDLContract  (these are parameters used just in the design of the report )

3)QueryContracts (the query  LIST associated with the execution of the DP)

4)PrintContracts (these are the print destination settings associated to report execution)

you can explicitly set all these for a report once the report name is set and you have ReportContract object

Hope this might be of some help

Cheers

Venkatesh

Reply
Jim Bonnie IBIS responded on 3 Jul 2013 7:18 AM

I am so happy to have found this snippet of code,

contract = controlerObj.ParmReportContract().ParmRDPContract() as ReportContractClass

That did the trick for me!

Thanks, Jim

Reply
Verified Answer
Daniel Weichsel responded on 6 Nov 2012 1:56 PM

You can use the SrsReportRunController class as in this example:

   SrsReportRunController  controller;

   controller = new SrsReportRunController();

   controller.parmReportName(ssrsReportStr(LedgerTrialBalance, Summary));

   controller.startOperation();

The controller has additional parm methods to help control running the report, such as parmShowDialog which you can use to skip the report dialog.

For advanced features you can create a new controller class extending SrsReportRunController and override methods.  For example, by overriding the prePromptModifyContract method you can manipulate the query or other data members before the dialog is shown.

Reply