Column Chart Report
Column Chart Report
A chart provides a graphical representation of data. Displaying data in a chart makes it easy for users to
see comparisons, patterns, and trends in the data. In this walkthrough, you will create a report to display
customer transaction data in a column chart.
Defining a query
Creating a reporting project
Creating a report with a column chart
Creating and configuring report parameters and filters
Applying layout and style templates
Changing the format to a bar or line chart
Prerequisites
Note
This walkthrough uses the CustTable, CustTrans, and CustGroup tables. In order to view
data in the report, these tables must be populated with data.
Defining a Query
There are several ways to retrieve data for reports. In this walkthrough, you will use a query that is defined
within the Microsoft Dynamics AX development environment. You will create a query using
the CustTable table as the data source. In the report, you will filter the data that is displayed based on
the TransType field that is from the CustTrans table so you will add the CustTrans table as a data source.
The following procedure explains how to define the query that will be used to retrieve customer
transaction data.
1
Source: http://msdn.microsoft.com/en-us/library/cc554854.aspx
To define a query
Property Value
JoinDataSource CustTable_1
Field AccountNum
12. In the AOT, right-click the Ranges node for the CustTrans data source, and then click New
Range.
13. Select the node for the range, and in the Properties window, select the TransType field from the
drop-down menu for Field.
Note
A report parameter is automatically generated for the range when the query is used in a
report dataset and the Dynamic Filters property is set to False.
14. The TransType field is an enum type. When you define the report, you must know the value of
theEnumType 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, note that the EnumType property is set to LedgerTransType.
15. Locate the CustGroup table and drag it onto the Data Sources node located below
the CustTrans data source.
16. In the CustGroup_1 data source node, select the Fields node, in the Properties window, set
theDynamic property to Yes.
17. Right-click the Relations node for the CustGroup data source, and then click New Relation.
18. Select the node for the relation and specify the following values in the Properties window.
Property Value
JoinDataSource CustTable_1
Field CustGroup
Next, you will create a reporting project in Microsoft Visual Studio. When you create an Microsoft
Dynamics AX project, you can choose from two project templates: Report Model and EP Web
Application. In this walkthrough, you will use the Report Model template.
Before you create a chart, you need to decide what type of chart to create. There are two types of
charts: XY charts and pie or doughnut charts. An XY chart is a column, line, or bar chart. During design, you
can switch between related chart types. For example, you can create a column chart and then later change
it to a bar or line chart. In this walkthrough, you will begin by creating a column chart. Later in the
walkthrough, you will change the design so that the data displays in a bar chart and then in a line 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 Dynamics AX
Source
Data Query
Source
Type
Default ColumnChart
Layout
Dynamic False
Filters
Name CustomerTransactions
Query 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.
Select theCustTransactionData query. Expand the CustTrans > All
Fields node. Select the TransDateand AmountMST fields. Expand
the CustGroup > All Fields node and select the Namefield.
8. In Model Editor, expand the node for the CustomerTransactions dataset if it is not already
expanded.
9. Select the AmountMST field, and in the Properties window, set the Aggregate
Function property toSum and the Format String property to Currency.
10.
11. Right-click the Datasets node, and then click Add Dataset. You will create an dataset with an AX
Enum Provider data source for the TransType enum field. This will allow you to filter the report to
show specific transaction types.
12. Select the node for the dataset.
13. In the Properties window, specify the following values.
Property Value
Data Source Dynamics AX
Name LedgerTransTypeEnum
Query LedgerTransType
14. Drag the CustomerTransactions node onto the Designs node for the report. An auto design
calledAutoDesign1 is created for the report.
15. Expand the AutoDesign1 node, expand the node for the chart data region, and then expand
the Datanode.
16. Drag the Name field to the Categories node.
17. Drag the TransDate field to the Series node.
Note
The AmountMST field should be the only field that remains below the Data node.
Next, you will create and configure several parameters and filters for the report. The report already
contains a parameter for the TransType field since a range based on this field was added to the query
when it was defined in the AOT and you set the Dynamic Filters property for the data set to False. You
will add some additional parameters to allow users to specify the to date and from date. After you have
created the parameters, you will create filters to filter the data based on the range specified by the user.
The following procedure explains how to create and configure the report parameters and filters.
Property Value
Allow Blank False
Data Type Integer
Default 2
Value
This will display only the Sales order transactions on the report.
Values Click the ellipsis button (...) to open the Select Values dialog box. Set the
following values:
Dataset: LedgerTransTypeEnum
Value field: Value
Label field: Label
Visibility Hidden
3. This will limit the query to return only sales invoice transactions and hide the parameter so that it
does not display to the users.
4. In Model Editor, right-click the Parameters node and then click Add Parameter.
5. Select the node for the parameter.
6. In the Properties window, specify the following values.
Property Value
Data Type DateTime
Name FromDate
7. In Model Editor, right-click the Parameters node and then click Add Parameter.
8. Select the node for the parameter.
9. In the Properties window, specify the following values.
Property Value
Data Type DateTime
Name ToDate
10. In Model Editor, expand the Designs node, expand the AutoDesign1 node, and then expand the
node for the chart data region.
11. Right-click the Filters node, and then click Add Filter.
12. Select the node for the filter.
13. In the Properties window, specify the following values.
Property Value
Expression =Fields!TransDate.Value
Name FromDateFilter
Operator GreaterThanOrEquals
Value =Parameters!FromDate.Value
14. In Model Editor, right-click the Filters node, and then click Add Filter.
15. Select the node for the filter.
16. In the Properties window, specify the following values.
Property Value
Expression =Fields!TransDate.Value
Name ToDateFilter
Operator LessThanOrEquals
Value =Parameters!ToDate.Value
Next, you will specify layout and style templates for the report. A layout template defines the general
layout and style settings for a report. A style template contains the layout and style settings for a data
region that displays in the body of a report. You will apply the predefined templates that provided by the
Microsoft Dynamics AX framework. These templates are the standard templates for Microsoft Dynamics
AX reports. The following procedure explains how to apply layout and style templates to the report.
During design, you can switch between several related chart types. First, you will switch from a column
chart to a bar chart. After that, you will switch it to a line chart. The following procedures explain how to
switch between chart types.
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. From the Model Editor toolbar, click Preview.
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.
Click the tab for the Preview window to view the changes.