/ Microsoft / How to execute same report but different designs from different menu items?

How to execute same report but different designs from different menu items?

Learn, share and spread knowledge

A very common requirement of SSRS reports are that sometimes two or more reports are same but their designs are slightly different. Or you don’t want to customize the default report, but to develop same as the default report with slightly difference in the design. If your requirement is that so, you are at the right place to start.

I will try to communicate my learning about this through the default Vendor invoice transactions report in the Accounts Payable. I have a requirement to slightly customize the design and all other things would remain same.

What I have done is as follows:

  • Open Visual Studio Project -> Dynamics AX Model Projects in AOT.
  • Find out the project VendInvoiceReport -> Right-click it -> Edit as follows:

  • In the visual studio, double-click the report. It will open and create a new design VendInvoiceTransactionsList as follows:

  • Customize the design VendInvoiceTransactionsList and all other things remain same.
  • Copy the VendInvoice output menu item in AOT and set it’s name as Moeen_VendInvoice. It will open the same report but the design VendInvoiceTransactionsList will be rendered after customizing the controller class.
  • Customize the VendInvoiceController class as follows:
public void execute(Args _args)
{
    if(BrazilParameters::isEnabled())
    {
        this.parmReportName(ssrsReportStr(VendInvoice, ReportBR));
    }
    else
    {
        //Moeen Ahmed Sultan
        //Based on the menu item name, different designs will run
        
        if(this.parmArgs(_args).menuItemName() == "VendInvoice")
        {
            this.parmReportName(ssrsReportStr(VendInvoice, Report));
        }
        else if(this.parmArgs(_args).menuItemName() == "Moeen_VendInvoice")
        {
            this.parmReportName(ssrsReportStr(VendInvoice, VendInvoiceTransactionsList));
        }
    }
    this.parmArgs(_args);
    this.startOperation();
}

Now, deploy the reports and run the newly created menu item. It will open the VendInvoiceTransactionsList design of VendInvoice report.

There are other methods as well to open different designs using different menu items. I will share them too.

Our greatest glory is not in never falling, but in rising every time we fall. — Confucius

1 POST COMMENT

Send Us A Message Here

Your email address will not be published. Required fields are marked *

1 Comments