Running a different design of a report-Part 1
The subject has been asked many times in community, so it made me thought to blog this. Using Standard AX, we can have multiple designs of same report. We might be in situations where we need to run a certain design at runtime. I am using word ‘Runtime’ because reports supported by print management can be configured in a way that you can choose which design to run when report is printed. E.g. you can print different designs of same report, in different companies.
But, there can be situation when you want to print different design of report within same legal entity. This refers to opening specific design of the report at runtime by code.
To do that first aspect we need to have a look, as measure or prerequisite, is whether a report is based on Print management or not. Based on that we can further decide how to write code.
In this post assume the case, your report is based on print management. A typical example can be taken from any of trading documents such as Sales Order, Purchase Order, and Sales Quotation etc. etc.
For practical demonstration let’s take example of Sales Order Confirmation report which is one of most widely used report for trading companies. Our goal is to open a new/existing or customized design of report (which is not setup in print management). Let’s proceed.
First of all have a look at your print management setup, where you can define which report design you want to run.
As we can see that, we have setup for existing standard report design. We don’t have any customization in this area yet.
Let’s run the report.
So, here is what standard output was supposed to be.
Now let’s add a customized design into existing report on Visual Studio.
Deploy the new design.
Let’s look inside AOT.
Yes, we have got new design in AOT.
Now, let’s proceed to open this design by code, which is our real matter/subject.
For that we need to override OutputReport method on controller class of specific report.
Here, we can specify our custom design of existing report based on any required conditions.
Let’s do that.
As you can see I have specified name of my new design, which was added in existing report.
Let’s save our changes. And run the report, again.
Here we go, with our custom design, of existing report.
So, this is how, we can open N number of designs of a report which is using Print Management. if its required to open a design based on any condition you can also add those.
In next part we will see, how to open a customized design for a report which is not using print management.
*This post is locked for comments