In part1 we saw that, how we can run a customized/new design of an existing report, when report is based on Print Management.
2nd case, is when your report is not based on Print Management framework.
For this 2nd case, when report is not based on print management, you can specify your design into Controller call main method. You don’t need to override OutputReport method as you did previously. Here specify new design name in Main method of controller class. And yes, if you don’t have a controller class for your report, you can create one. There is not restriction. Let see practically how to do that.
So, for demonstration purpose lets a take a report of Sales Module as shown below.
Let’s add a new design in Visual Studio.
Finally let’s specify our new design in controller class. Now, in demo example we have a case where we got controller class already. So let’s modify its main method to specify our new design.
Now let’s run the report.
As you can see that, we have got our customize design which we just added in visual studio and by specifying this new design in controller class main method, we override the existing standard design of report.
So, that’s how we can forcefully open a customized design of an existing report.
Let’s proceed a steps ahead, and have a look at, what if we want to run customized design or existing report design any one, based on some condition? How to do that. The answer to question is, same ways as we did above practice, we can add conditions in our controller class, using which we can control the dynamic call of report design. Let see practically how we can do that. So, we will take same example, which we just followed in above practice.
Here I am going to add some condition, in my controller class, to call any design based on my choice or conditions.
Have a look at below red marked code.
What I am doing basically, that using dialog I will be showing a message to user where he/she will get the choice to choose design, whether he/she want to open new/customized or existing/standard design.
Let’s save our changes and run the report. (Don't forget to read Dialog/popup message in below screenshot)
Let it go, without marking the dialog.
As, we can see we got existing standard design of report, which is not our customized design. This is because we did not choose the option for new design.
Let’s run report again. This time I will choose the option to run customized design.
Here we go with our customized design based on conditions.
Conclusion:
The controller class of reporting framework is something which can provide you many ways to play with design of the report at runtime, irrespective of whether a report is based on Print Management or not. In both cases we can control N number of designs for any report, based on any conditions.
*This post is locked for comments