Walkthrough: Creating an Auto Design Report
This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.
Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
In this walkthrough, you will create a basic report that displays a list of inventory items. You will use an auto design report. In this type of report, the report design is automatically generated for you based on the report data. After you have created the report, you will add some interactive features, such as drill down capability and a document map. The following illustration shows the report that you will create in this walkthrough.
The data that displays in your report may vary depending upon the sample data that is available to you.
This walkthrough illustrates the following tasks:
Defining a query
Creating a reporting project
Creating an auto design report
Modifying the look of a report
Adding interactive features to a report
To complete this walkthrough, you will need:
Microsoft Dynamics AX with sample data
This walkthrough uses the InventTable table. In order to view data in the report, this table must be populated with data.
Microsoft Visual Studio 2010
Microsoft Visual Studio tools for Microsoft Dynamics AX
Defining a Query
There are several ways to retrieve data for reports. In this walkthrough, you will use a query that is defined in the AOT within Microsoft Dynamics AX development environment. The following procedure explains how to define a query that will be used to retrieve item data.
To define a query
Open Microsoft Dynamics AX.
In the AOT, right-click the Queries node, and then click New Query.
Right-click the node for the query, click Rename, and then type Items.
Expand the Items node.
Right-click the Data Dictionary node, and then click Open New Window.
In the new window, expand the Tables node.
Locate the InventTable table and drag it onto the Data Sources node for the Items query.
Expand the Data Sources node, click the data source that you added in step 7, right-click Fields, and then click Properties.
In the Properties window, set the Dynamic property to Yes.
Save the query.
Creating a Reporting Project
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 displays.
In the Installed Templates pane, click Microsoft Dynamics AX, and in the Templates pane, click Report Model.
In the Name box, type SampleItemReport. In the Location box, type a location.
Creating an Auto Design Report
Now that you have created a reporting project, you are ready to define an auto design report that will display data from the Items query. The following procedure explains how to create an auto design report.
To create an auto design report
In Solution Explorer, right-click the SampleItemReport project, point to Add, and then click Report.
In Model Editor, right-click the new report and click Rename. Type ItemReport as the name.
Expand the ItemReport 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.
Data Source Type
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 the Items query, expand the All Fields node, select ItemId, ItemType:NAME, ItemType:LABEL, NameAlias and then click OK.
In Model Editor, select Items > Fields > ItemType.
In the Properties window, set the Display Width property to 2.5in.
In Model Editor, select the Items node and drag it onto the Designs node. An auto design named AutoDesign1 is created for the report.
Modifying the Look of a Report
Next, you will specify layout and style templates for the report. A layout template is used to define the placement of the headers and footers in a report. Style templates are used to adjust the style settings for the data regions that are displayed in a report, such as the size of the text, borders, and background color. Layout and style templates are useful for defining reusable layout and style settings. A template can be applied to many reports to maintain consistency across reports.
A style template is specific to a data region type. So, if you define a style template for a table, it can only be applied to table data regions. It cannot be applied to list or matrix data regions. In this example, the data will be displayed in a table data region since you specified Table for the Default Layout property for the dataset. The following procedures explain how to apply layout and style templates for the report.
To apply layout and style templates
In Model Editor, select the AutoDesign1 node.
In the Properties window, set the Layout Template property to ReportLayoutStyleTemplate. Also, type Inventory items for the Title property.
In Model Editor, expand the AutoDesign1 node, and then select the node for the ItemsTable data region.
In the Properties window, set the Style Template property to TableStyleTemplate.
From the Model Editor toolbar, click Preview.
In the preview window, select the report tab to view the style settings for the report.
Close the Preview window.
Adding Interactive Features to a Report
Next, you will add some interactive features to the report. You will start by adding a data grouping to the report to group items according to the item group. After that, you will change the order that the groups are displayed. Finally, you will modify the report so that it displays a document map.
To add a grouping
In Model Editor, expand the AutoDesign1 node, expand the node for the ItemsTable data region, and then expand the Data node.
Drag the ItemType1 field that is located below the Data node onto the Groupings node.
From the Model Editor toolbar node, click Preview.
To add a sort order
In Model Editor, expand the ItemsTable data region, right-click Sorting and then click Add Sort.
In the Properties window, set the Sort By property to =Fields!ItemType1.Value and the Sort Order property to Descending.
Click the tab for the Preview window to view the report.
The report display will refresh.
To add a document map
In Model Editor, select the node for the ItemsTable data region.
In the Properties window, set the Data Navigation Style property to DocumentMap.
Click the tab for the Preview window to view the report.
The report display will refresh. Notice the document map on the left side of the report. You can click an item group in the document map and the report displays the data for the items in that group.
To add a report to the AOT
- In Solution Explorer, right-click the SampleItemReport project and then click Add SampleItemReport to AOT.
The new report has been added to the AOT. For information about how to integrate new reports into Microsoft Dynamics AX, see Walkthrough: Integrating New Reports into Microsoft Dynamics AX.