Monday, January 16, 2012

SSRS report in EP based on user selection

In this post, I will be explaining how to display SSRS report to Enterprise portal based on user input. The example which we will be following has a scenario to display pay slip report for each employee. The requirement can be that each employee should see his pay slip for any month based on selection. It means we have to pass two parameters i.e. the user logged in and the date he selected for the pay slip or with one parameter to filter query based on worker logged in.

To achieve this we have to do following steps

1.      Create SSRS report using data provider class and deploy it on server .

2.      Create DataContractor class to add a parameter which implements  SysOperationInitializable and SysOperationValidatable interfaces.

3.      Create a data provider class which will be filling temporary table on the basis of parameters passed through contractor class.

4.      Create a EP page which contains date calendar and a reportviewer control. We will be rendering report based on selected date.
[Note: Code written for classes is just for reference. It depends on the table and query as per your criteria. I am simply pasting code which is specific for my case. Do modify it as per your AOT structure.]

Now let’s see the detail.


Contractor class:


Data Provider class:




Now this is what we required to do in Dynamics AX. Let’s just see the modifications required on Visual studio EP project.
Web Control:


Add a web control to an EP project and then add following two controls

·         Calendar

·         AXReportViewer


 
Now, to render the report we will set the user selected date and on the event of selection change we will render the report as shown


I hope you will find this post helpful. In case of any question or help in this regard you are welcome.

Happy Daxing J

No comments: