Removing Persistent SSRS Parameters in Dynamics AX 2012 Reports

Removing Persistent SSRS Parameters in Dynamics AX 2012 Reports

(This is specific to reports using a Report Data Provider)
I built an SSRS report to retrieve a list of all prices from specific vendors. In this report, there are a number of parameters: Item Status, Prices to display, Inventory On Hand, and of course Vendor Account.

A system user selects various parameters to run this report. As is customary in these SSRS reports, the next time that the user opens this form to run the report, all of the parameters that they selected for the prior report run are pre-selected by default. However, it is possible to default these values to your choosing.

In my case, my users simply wanted all the parameters to be cleared when they open the form. This can be achieved by calling the parmLoadFromSysLastValue method (extended from the SrsReportRunController class) with a false parameter in the RDP Controller class.

After this is compiles, all of your report parameters will be defaulted to blank regardless to what was entered previously by the user.

In a more complicated scenario, you might want one or more of these parameters to either be checked by default while the others are blank. In this case, you can make use of the prePromptModifyContract method in the RDP Controller class.

Here, you will need to reference your contract class where your various parameters are defined and then specify your values. If I want to default the “Status A” to be automatically checked while the rest are blank, I can use the following code:

My result when the report is opened:

I should note that the Display Inventory and Prices to Display parameters are not part of my Report Data Provider. Those were implemented and deployed entirely from Visual Studio so they cannot be referenced in the RDP Controller class like the Item Status and Vendor Account parameters can be. Although the first method to remove all previous values (parmLoadFromSysLastValue) will work to clear out all parameters, if you want to specify values for the non-RDP parameters, you will need to do that in Visual Studio or convert them to RDP parameters in your Contract class.

Share on Google+Tweet about this on TwitterShare on LinkedInShare on FacebookEmail this to someone