Walkthrough: Creating an Auto Design Report (Visual Studio Reporting Tools for Microsoft Dynamics AX)
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.
.gif)
Note |
|---|
|
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
Note This walkthrough uses the InventTable table. In order to view data in the report, this table must be populated with data.
-
Microsoft SQL Server 2005
-
Microsoft Visual Studio 2008
-
Microsoft Dynamics AX Reporting Tools for Microsoft Visual Studio
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.
-
Save the query.
Next, you will create a reporting project in Microsoft Visual Studio. When you create a reporting project, you can choose from two project templates: Visual Basic and Visual C#. In this walkthrough, you will use the Visual C# template. After you have created a project, you will add another project to your solution so that you can reference several predefined layout and style templates that you will use to define the layout of your reports. These templates are the standard templates for Microsoft Dynamics AX reports.
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 Project Types pane, click the Visual C# node, and in the Templates pane, click Dynamics AX Reporting Project.
-
In the Name box, type SampleItemReport, and in the Location box, type a location.
-
Click OK.
A reporting project contains a model by default. A model is a file with the .moxl file name extension. When a reporting project first opens in Microsoft Visual Studio, the model automatically displays in Model Editor. It contains a default report named Report1.
To reference the project that contains the standard layout and style templates
-
On the File menu, point to Add and then click Existing Project from Dynamics AX.
A dialog box displays where you can select a project that currently exists under the Report Library node in the AOT.
-
In the dialog box, select Shared Library, and then click OK.
-
In Solution Explorer, right-click the SampleItemReport project, and then click Add Reference.
-
In the Projects tab, select SharedLibrary, click Add, and then click OK.
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 Model Editor, right-click the Report1 node, and then 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.
Property
Value
Data Source
Dynamics AX
Data Source Type
Query
Default Layout
Table
Name
Items
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 the Items query, and then select the ItemGroupId, ItemId, and ItemName fields. Be sure the All check box is not marked.
-
In Model Editor, expand the Items node, and then select the ItemName node.
-
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.
-
Right-click the AutoDesign1 node, and then click Preview.
Notice that the report appears unformatted, as you have not yet applied any layout or style templates to it.
-
Close the Preview window.
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. You will use templates that are already defined in the SharedLibrary project.
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.
-
In Model Editor, right-click the AutoDesign1 node, and then click Preview to view the new style settings for the report.
-
Close the Preview window.
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 add the capability for users to drill down into a particular item group. 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 ItemGroupId field that is located below the Data node onto the Groupings node.
-
Right-click the AutoDesign1 node, and then click Preview.
To add drill-down capability
-
In Model Editor, select the node for the ItemsTable data region.
-
In the Properties window, set the Data Navigation Style property to DrillDown.
-
Click the tab for the Preview window to view the report.
The report display will refresh. Notice that you can now expand and collapse the groups in the report.
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.