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.
21. Save the query.
To define a query
- Open
the Microsoft Dynamics AX Development Workspace.
- In
the AOT, right-click the Queries node, and then click New Query.
- Right-click
the node for the new query, click Rename, and then type
CustTransactionData. Expand the node for the CustTransactionData query.
- In
the AOT, right-click the Data Dictionary node, and then click Open New
Window.
- In
the new window, expand the Tables node.
- Locate
the CustTable table and drag it onto the Data Sources node for the query.
- 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.
- Locate
the CustTrans table and drag it onto the Data Sources node located below
the CustTable data source.
- In
the CustTrans_1 data source node, select the Fields node, in the
Properties window, set the Dynamic property to No.
- 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.
- Right-click
the Relations node for the CustTrans_1 data source, and then click New
Relation.
- 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
|
- In
the AOT, right-click the Ranges node for the CustTrans_1 data source, and
then click New Range.
- Select the node for the range, and in the Properties window, select the TransType field from the drop-down menu for Field.
- 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.
- Locate the CustGroup table and drag it onto the Data Sources node located below the CustTrans_1 data source.
- In the CustGroup_1 data source node, select the Fields node, in the Properties window, set the Dynamic property to No.
- In the separate window, expand the CustGroup table > Fields node. Drag the Name field to the Fields node of the CustGroup_1 data source.
- Right-click the Relations node for the CustGroup_1 data source, and then click New Relation.
- 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
|
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
- Open
Microsoft Visual Studio.
- On
the File menu, point to New, and then click Project. The New Project
dialog box is displayed.
- In
the Installed Templates pane, click Microsoft Dynamics AX node, and in the
Templates pane, click Report Model.
- In
the Name box, type SampleChartReport, and in the Location box, type a
location.
- Click OK.
To create a report that has a column chart
- In
Solution Explorer, right-click the SampleChartReport project, point to
Add, and then click Report.
- In
Model Editor, right-click the Report1 node, and then click Rename.
- Type
ColumnChartReport as the name.
- Expand
the ColumnChartReport node if it is not already expanded.
- Right-click
the Datasets node, and then click Add Dataset.
- Select
the node for the dataset.
- 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.
|
- In
Model Editor, expand the node for CustomerTransactions > Fields.
- Select
the AmountMST field, and in the Properties window, set the Aggregate
Function property to Sum and the Format String property to Currency.
- 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.
- Select
the node for the dataset.
- In
the Properties window, specify the following values.
Property
|
Value
|
Data Source
|
Dynamics AX
|
Data Source Type
|
AX Enum Provider
|
Name
|
LedgerTransTypeEnum
|
Query
|
LedgerTransType
|
- Drag
the CustomerTransactions node onto the Designs node for the report. An
auto design called AutoDesign1 is created for the report.
- Expand
the AutoDesign1 node, expand the node for the chart data region, and then
expand the Data node.
- Drag
the Name field to the Categories node.
![]() |
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
- In
Model Editor, expand the Parameters node for the report, and then select
the CustomerTransactions_TransType parameter.
- 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
- In
Model Editor, select the AutoDesign1 node.
- In
the Properties window, set the LayoutTemplate property to
ReportLayoutStyleTemplate. Also, type Customer transactions for the Title
property.
- In
Model Editor, expand the AutoDesign1 node, and then select the node for
the chart data region.
- In
the Properties window, set the Style Template property to
ColumnChartStyleTemplate.
- Delete
the default text for the Title property so that it does not display a
title for the data region.
- 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.
- 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.
- Close
the Preview window.
To switch the format to a bar chart
- In
Model Editor, select the node for the CustomerTransactionsXYChart chart
data region.
- In
the Properties window, set the Chart Type property to Bar.
- 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
- In
Model Editor, select the node for the CustomerTransactionsXYChart chart
data region.
- In
the Properties window, set the Chart Type property to Line.
- 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
Post a Comment