Recently I had a requirement to hide report parameters from report dialog based on the caller menu item. So here is how to do it. I will show you the example of production picking list report. Production picking list report in AX 2012 feature pack version has the following report parameters:
There are three parameter groups on the report dialog above which are as follows:
- Parameters
- If connected to purchase order
- View
And below is the classDeclaration of the contract class, as shown below:
The View group fields comes from InventDimViewContract class which is added as a parm method in ProdPickListContract class to show the options for all inventory dimensions.
Suppose, we want to hide all the parameter groups from report dialog and just want to display the dynamics filters on the report. You need to modify the UIBuilder class of your report. For production picking list report, the UI Builder class is ProdPickListUIBuilder. The build method needs to be modified and the code in Bold below can be used to hide the whole parameter group from SSRS report dialog:
public void build()
{
FormBuildGroupControl grp;
grp = this.dialog().curFormGroup();
grp.frameType();
grp.columns(2);
if (this.controller().parmArgs().menuitemName() == #yourMenuItemName)
{
grp.visible(false);
}
super ();
}
Below is the output, after hiding the whole parameter group:
To hide the dynamic filters from SSRS report dialog based on caller menu item, you need to override the following method in your controller class and return false from this method based on your condition:
showQueryValues
Override this method in your controller class and write the following code:
public boolean showQueryValues(str parameterName)
{
If (this.parmArgs().menuItemName() == menuItemOutputStr(#YourMenuItemName)
{
return false;
}
else
{
return true;
}
}
You will see the following output when the report is run:
Only the Printer and Print destination options will be shown which is displayed by default on the reports.
Enjoy reporting.
No comments:
Post a Comment