Saturday, 30 November 2013

SSRS Ax 2012: How to create a simple SSRS report

This is an attempt to create the simplest SSRS report for Dynamics Ax. 
And to start with, lets see what all tools I am using.
  • Microsoft Dynamics Ax 2012 R2
  • Visual studio 2010 Ultimate
  • Visual studio tools (Dynamics Ax Component)
  • Microsoft SQL 2008 R2
Steps to create the simplest SSRS Report:
  1. Launch Visual studio.
    Create a new project and select Template "Microsoft Dynamics Ax" and select Report Model. 
  2. And in the Solution explorer, you will find a ReportModel.
    You will need to Add report, by clicking the Add button shown in the below image and then selecting Report. Then you will see a new report "Report1" as shown.
  3. If you double click the Report1. Then you will see something like a part of AOT in Dynamics Ax as shown.
  4. The nodes available under the Report1 are Datasets, Desgins, Images, Data methods & Parameters. And for a simple SSRS report, our task will be to create something under theDatasets & Designs and then bind the two.
    Dataset - would be a tabular set of data that we will get from Ax. We will use Ax queries to get the data for this example.
    And Design is a layout - a page where we will put in the design and map the dataset to a table or something.
    And we should be able to generate a report. Not so beautiful report but a simple SSRS report to start with.
  5. To create a new dataset, Right click on the Datasets node and Add Dataset. Rename the newly created Dataset to any appropriate name.
  6. And in the properties window of the newly created dataset, set the query to an Ax Query by using which the report will actually fetch the data and display. We have bunch of other options which can be customized as well.
    For selecting query, click on the ellipses and then select appropriate Ax Query ( I selectedCustTableSRS and then click next to navigate to a window to select fields needed (illustrated in below figure) 
  7. Select all fields and click ok. And you will find a query automatically populated in the Query property of Report1. Something like, SELECT CustTable.1.AccountNum,CustTable.1.CustGroup FROM CustTableSRS.
    And also the fields will shop up under the Fields node.
  8. So now we have the dataset populated and fields shown in place. The next step would be to create the design.
  9. And the simplest way to create a design is to drag the dataset into the Designs node.By doing so, you will actually generate an Auto-Design "AutoDesign1"
  10.  And once the AutoDesign is created you are ready to go. You can render the report byRight clicking the AutoDesign1 > and click Preview.
  11. In the opened Report1 preview, enter the parameters needed. In this case, select some value for the CustGroup, say, * (to select all values).
  12. And click Report Tab, to view the report as below.
So that is how we can create a report, a very simple, basic and a quick report using Visual studio 2010 for Dynamics Ax 2012. 

No comments:

Post a Comment