Walkthrough: Designing a Customer List Report
In Microsoft Dynamics NAV 2009, the process of creating new reports is divided into three phases:
Defining the data model on which the report is based.
Defining grouping and totaling for the report.
Designing the visual layout of the report.
With Microsoft Dynamics NAV, you can use Visual Studio Report Designer to design and edit the visual layout of a report.
About This Walkthrough
This walkthrough provides an overview of how to create a report that is based on one table with Microsoft Dynamics NAV and design this report using Visual Studio Report Designer. This walkthrough illustrates the following tasks:
Create a report in Microsoft Dynamics NAV.
Apply sorting criteria and filters on the report in Microsoft Dynamics NAV.
Design the layout of the report in Visual Studio.
To complete this walkthrough, you will need:
Microsoft Dynamics NAV 2009 with a developer license.
The CRONUS International Ltd. demo data company.
Visual Studio. For more information about versions of Visual Studio that you can use, see Requirements for Developing Reports for the RoleTailored Client.
Defining the Data Model
When you create a new report, you must define where the data that the report will display should come from. You define the data model in Microsoft Dynamics NAV.
To define the data model
In the Classic client, on the Tools menu, click Object Designer.
In Object Designer, click Report, and then click the New button to open the New Report window.
In the Table field, click the drop-down arrow, and then select the Customer table in the Table List window.
Select Create a report using a wizard, and then choose Tabular-Type Report Wizard. Click OK.
In the Tabular-Type Report Wizard, select the No., Name, Address, and Phone No. fields, and then click Next.
Accept the default selection for the report in the next windows.
Click the Finish button, and the Report Designer window opens.
Applying Sorting Criteria and Filters
Next, you must decide what sorting criteria and filters that can be used in the report. This report will sort the customers in ascending order by customer number and have a filter for searching by customer number and country/region code.
To set the report properties
In Report Designer, select the Customer data item.
On the View menu, click Properties.
In the Properties window, select the DataItemTableView property, and in the Value field, click the drop-down arrow to open the Table View property.
Select the No. field as the key, and then set the sort order to Ascending. Click OK.
In the Properties window for the Customer data item, select the ReqFilterFields property, and in the Value field, click the drop-down arrow to open the Field List window.
Select the No. and Country/Region Code fields, and then click OK.
On the File menu, click Save As.
Give the report ID 55551 and the name CustomerList.
Click OK to save and compile the report.
Designing the Report Layout
After you have saved and compiled the report in the Classic client, you must transform the layout and open it in Visual Studio. You can then use Visual Studio to edit and design this report. For this report, you will set the header to use a larger font and the company name to use the red font color.
To design the layout of the report
In the Classic client, in Object Designer, locate the CustomerList report, and then click the Design button.
On the Tools menu, click CreateLayout Suggestion. Visual Studio opens and displays the current layout of the report.
In the Page Header section of the layout, click the CustomerCaption1 text box.
On the View menu, click Properties Window.
In the Properties window, expand the Font property and select FontSize. Set FontSize to 12pt.
In the Page Header section of the layout, click the COMPANYNAME1 text box.
On the View menu, click Properties Window.
Set the Color property to Red.
Save the report in Visual Studio.
In the Classic client, open the same report in Report Designer. A message informs you that the .rdlc file for this report has changed and asks if you want to load the changes. Click Yes to save the changes in the database.
Compile the report.
Click Run to run the report from the Classic client.
To view the changes that you made in Visual Studio, run the report in the RoleTailored client. For more information about running a report in the RoleTailored client, see How to: Use a Shortcut to Run a Report.
- Now you have created a report that lists customers sorted by customer number, and you have added a few changes to the report layout using Visual Studio. The next step is to add the customer list report to a page in the RoleTailored client from where it can be run. For more information, see How to: Make a Report Available in the RoleTailored Client.
How to: Make a Report Available in the RoleTailored Client
Walkthrough: Creating a Link from a Report to a Page
Walkthrough: Designing a Report with Images, Interactive Sorting, and Visibility Toggle
Walkthrough: Designing a Customer Sales Order Report