How to use Enum Provider as datasource for your SSRS reports in AX 2012.

Today I will demonstrate you that How to use Enum Provider as datasource for SSRS Reports in AX 2012.

To define a query
  1. Open the Microsoft Dynamics AX Development Workspace.
  2. In the AOT, right-click the Queries node, and then click New Query.
  3. Right-click the node for the new query, click Rename, and then type CustTransactionData. Expand the node for the CustTransactionData query.
  4. In the AOT, right-click the Data Dictionary node, and then click Open New Window.
  5. In the new window, expand the Tables node.
  6. Locate the CustTable table and drag it onto the Data Sources node for the query.
  7. In the CustTable_1 data source node, select the Fields node, in the Properties window, set the Dynamic property to No. You will select the specific fields that will be used on the report instead of sending all data in the table. This will produce faster running reports.
  8. Locate the CustTrans table and drag it onto the Data Sources node located below the CustTable data source.
  9. In the CustTrans_1 data source node, select the Fields node, in the Properties window, set the Dynamic property to No.
  10. In the separate window, expand the node for the CustTrans table > Fields, drag the AmountMST field to the Fields node of the CustTrans_1 data source.
  11. Right-click the Relations node for the CustTrans_1 data source, and then click New Relation.
  12. Select the node for the relation and verify the following default values in the Properties window.
Property
Value
JoinDataSource
CustTable_1
Field
AccountNum
Related Field
AccountNum
  1. In the AOT, right-click the Ranges node for the CustTrans_1 data source, and then click New Range.
  2. Select the node for the range, and in the Properties window, select the TransType field from the drop-down menu for Field.
  3. The TransType field is an enum type. When you define the report, you must know the value of the EnumType property when you define the AX Enum Provider data source. To find the property value, in the AOT, click Data Dictionary > Tables > CustTrans > Fields > TransType. In the Properties window, notice that the EnumType property is set to LedgerTransType.
  4. Locate the CustGroup table and drag it onto the Data Sources node located below the CustTrans_1 data source.
  5. In the CustGroup_1 data source node, select the Fields node, in the Properties window, set the Dynamic property to No.
  6. In the separate window, expand the CustGroup table > Fields node. Drag the Name field to the Fields node of the CustGroup_1 data source.
  7. Right-click the Relations node for the CustGroup_1 data source, and then click New Relation.
  8. Select the node for the relation and specify the following values in the Properties window.  
Property
Value
JoinDataSource
CustTable_1
Field
CustGroup
Related Field
CustGroup
    21. Save the query.


Next, you will create a reporting project in Microsoft Visual Studio. In this walkthrough, you will use the Report Model template.

To create a reporting project
  1. Open Microsoft Visual Studio.
  2. On the File menu, point to New, and then click Project. The New Project dialog box is displayed.
  3. In the Installed Templates pane, click Microsoft Dynamics AX node, and in the Templates pane, click Report Model.
  4. In the Name box, type SampleChartReport, and in the Location box, type a location.
  5. Click OK. 

To create a report that has a column chart
  1. In Solution Explorer, right-click the SampleChartReport project, point to Add, and then click Report.
  2. In Model Editor, right-click the Report1 node, and then click Rename.
  3. Type ColumnChartReport as the name.
  4. Expand the ColumnChartReport node if it is not already expanded.
  5. Right-click the Datasets node, and then click Add Dataset.
  6. Select the node for the dataset.
  7. In the Properties window, specify the following values.
Property
Value
Data Source
Dynamics AX
Data Source Type
Query
Default Layout
ColumnChart
Dynamic Filters
False
Name
CustomerTransactions
Query
1.      Click the ellipsis button (…). A dialog box displays where you can select a query that is defined in the AOT and identify the fields that you want to use.
2.      Select the CustTransactionData query and then click Next.
3.      Expand the CustTrans_1 node and select the All Fields check box. This will select the AmountMST field.
4.      Expand the CustGroup_1 node and select the All Fields check box. This will select the Name field.
5.      Click OK.
  1. In Model Editor, expand the node for CustomerTransactions > Fields.
  2. Select the AmountMST field, and in the Properties window, set the Aggregate Function property to Sum and the Format String property to Currency.
  3. Right-click the Datasets node, and then click Add Dataset. You will create a dataset with an AX Enum Provider data source for the TransType enum field. This will let you filter the report to show specific transaction types.
  4. Select the node for the dataset.
  5. In the Properties window, specify the following values.
Property
Value
Data Source
Dynamics AX
Data Source Type
AX Enum Provider
Name
LedgerTransTypeEnum
Query
LedgerTransType
  1. Drag the CustomerTransactions node onto the Designs node for the report. An auto design called AutoDesign1 is created for the report.
  2. Expand the AutoDesign1 node, expand the node for the chart data region, and then expand the Data node.
  3. Drag the Name field to the Categories node.
NoteNote:-
The AmountMST field should be the only field that remains below the Data node.

The following procedure explains how to configure a report parameter.
To configure a report parameter
  1. In Model Editor, expand the Parameters node for the report, and then select the CustomerTransactions_TransType parameter.
  2. In the Properties window, set the following property values:
Property
Value
Allow Blank
False
Data Type
Integer
Values
Click the ellipsis button (...) to open the Select Values dialog box. Set the following values:
o    Dataset: LedgerTransTypeEnum
o    Value field: Value
o    Label field: Label
Make sure that From dataset is marked, and then click OK.


To apply layout and style templates
  1. In Model Editor, select the AutoDesign1 node.
  2. In the Properties window, set the LayoutTemplate property to ReportLayoutStyleTemplate. Also, type Customer transactions for the Title property.
  3. In Model Editor, expand the AutoDesign1 node, and then select the node for the chart data region.
  4. In the Properties window, set the Style Template property to ColumnChartStyleTemplate.
  5. Delete the default text for the Title property so that it does not display a title for the data region.
  6. Set the Value Axis Data Scale Minimum property to 5. This will set the starting value on the axis of your report to 5 instead of 0. This is one of many properties that will define the look of your report.
  7. In Model Editor, right-click the AutoDesign1 node, and then click Preview to view the report. Specify a transaction type for the parameter, like Customer, and then click the Report tab to view the report.
  8. Close the Preview window.

To switch the format to a bar chart
  1. In Model Editor, select the node for the CustomerTransactionsXYChart chart data region.
  2. In the Properties window, set the Chart Type property to Bar.
  3. In Model Editor, right-click the AutoDesign1 node, and then click Preview to view the report. Specify a transaction type for the parameter, like Customer, and then click the Report tab to view the report.

To switch the format to a line chart
  1. In Model Editor, select the node for the CustomerTransactionsXYChart chart data region.
  2. In the Properties window, set the Chart Type property to Line.
  3. In Model Editor, right-click the AutoDesign1 node, and then click Preview to view the report. Specify a transaction type for the parameter, like Customer, and then click the Report tab to view the report. 

Comments