AX2012 Print multiple reports to screen at the same time

It's common that customer require multiple reports to be printed with one button click. There are many ways to tackle this. The developer can override the click method of the menuitem button to call multiple reports. One can also customize the ReportController class to trigger other reports when run.
However, one characteristic with the above approaches is that when printing to screen, user will need to close the first report before the second one will be shown. To overcome this, we can modify the SrsReportViewer form.

Create a new form method to call another report
                
private void callSecondReport()
{
    SecondReportController newController;

    if (controller.parmReportName() == [First report])
    {
            // Print the second report
            newController = new SecondReportController();
            /*
             * Prepare the new controller
             */
            // ...
            
            newController.startOperation();
    }
}

Call the new form method at the end of the form's Run method.
public void run()
{
   // Standard code
   // ...

   this.callSecondReport();
}

Remember the changes above only works when the print destination is Screen. To have consistent behavior on different printing destinations, the changes to SrsReportViewer form has to be done in addition to what was mentioned at the beginning of the post. Furthermore, checkings will be needed such that the second report is not printed twice when print to screen.

This posting is provided "AS IS" with no warranties, and confers no rights.

Comments

  1. Instead of modifying a standard form (SrsReportViewer), which is being from everywhere and is part of core framework, another solution can be to modify only controller class for report. Bceuase customization of core framework form can be a trouble during upgrade. Also as per above code, i need to add the name of report in this form,so if i need to do this process for 100 reports, this form will be higly customized.
    Have a look at follwoing url for optimal solution

    https://community.dynamics.com/ax/b/microsoftdynamicsaxextensions/archive/2015/08/21/open-multiple-instances-of-report-at-same-time

    ReplyDelete
    Replies
    1. Hi Sohaib,
      Can you please let me know the process for generating single report multiples times for different different vendor if we are not passing any value in Vendor ID parameter.

      Delete
    2. Hi gulshan,
      Since Sohaib doesn't moderate this blog. I suggest you go to the link in his comments and leave your question there. :)

      Delete

Post a Comment