Hiding parameter or Dynamics filters on SSRS report dialog at runtime

Description:-

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 Item transaction summary report. Item transaction summary report in AX 2012 feature pack version has the following report parameters:



There are parameter on the report dialog above which are as follows:
·         From Date
·         To Date
·         Item Id
·         Item Group
·         Dimension

And below is the classDeclaration of the contract class, as shown below:

[DataContractAttribute,
    SysOperationContractProcessingAttribute(classstr(ItemTransactionSummaryUIB))]
class ItemTransactionSummaryContract implements SysOperationValidatable
{
    List  ItemGroupIdList,ListItemId;
    BaseDate FromDate,ToDate;
    NoYesId   IsDiamension;
}

The View group fields comes from ItemTransactionSummaryContract class.

Suppose, we want to hide all the parameter 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 Item transaction summary report, the UI Builder class is ItemTransactionSummaryUIB. 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() == "ItemTransactionSummaryController")
    {
        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)
{
    //return false;
    If (this.parmArgs().menuItemName() == menuItemOutputStr("ItemTransactionSummaryController"))
    {
        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.

Related Posts

Previous
Next Post »

Thanks for comments.....