In this walkthrough, you will design a simple customer list report based on the Customer table. The report is designed in the Microsoft Dynamics NAV Classic client using Report Designer.
Prerequisites
-
To complete this walkthrough, you will need:
-
Microsoft Dynamics NAV installed with a developer license.
-
The CRONUS International Ltd. demo data company installed.
Defining the Data Model
The first step in creating this report is to define the data model on which the report is based. You define the data model by creating the data items.
To define the data model
-
Click Tools, and then click Object Designer.
-
In Object Designer, click Report, and then click New. The New Report window opens.
-
In the Table field, click the AssistButton to select a table from the Table List window. For this example, select the Customer table.
-
In the Report section, click Create a blank report, and then click OK. The Report Designer window opens.
-
In the Data Item field, click the Assistbutton, and then select a table from the Table List window.
-
Click View, and then click Properties to open the Properties window for the data item.
-
Select the DataItemTableView property and in the Value field, click the AssistButton to open the Table View window.
-
Select the Key, Order and Table Filter to use and then click OK. In this example, select the No. field as Key and set the sort order to Ascending. The Table Filter field is left empty, meaning that a permanent filter is not defined on the table.
-
Select the ReqFilterFields property, and in the Value field, click the AssistButton to open the Field List window.
-
Select the fields on which users will frequently need to set filters. In this example, select the No. and Country/Region Code fields, and then click OK.
-
Click File, and click Save to save the report, and then run it from Object Designer to see the request form for this report.
Designing the Sections
Now that the data model is defined, you need to design the layout of the report. This is done using Section Designer.
To design the sections
-
With Report Designer open, click View, and then click Sections to open Section Designer.In Section Designer, a section named "Customer.Body (1)" has been inserted. By default a Body section is inserted for each data item that has been created.
-
Click Edit, and then click Insert New to insert a header section for the Customer data item. The Insert New Section window opens.
-
Select Header as the Section Type and click OK.
-
Click View, and then click Field Menu to open the field menu. Select the fields that you want in the report. Select multiple fields by holding down the CTRL key while selecting the fields.
-
Move the cursor into the Body section of the data item. Click once to activate the window—the cursor changes into the Control Insertion cursor. Place the cursor on the left side of the section and click again. A text box with an attached label is inserted for each field that you selected.
-
Click View, and then click Properties to open the Properties window. Click in the Header section to ensure that the Properties window displays the properties of the header. Note Look at the setting for SectionWidth (the unit of measure is 1/100 mm). The width of all the sections has been modified to make room for the controls that you inserted (the default width, when no controls have been inserted, is 12000). In this case, the resulting width is 15450, or 15.45 cm. This setting is fine if the report is going to be printed on A4 paper—A4 paper is 21 cm wide.
-
Select all the labels in the Body section by holding down the CTRL key while clicking, and move them all into the Header section. This preserves the alignment of the labels and text boxes.
-
Open the Properties window for the Header section and set the PrintOnEveryPage property to Yes. If the report consists of more than one page, the Header section will appear on every page.
-
Resize the Body section by moving the cursor into Section Designer until it touches the lower bound of the Body section and turns into the vertical resizing cursor. Then click and drag the section upwards until it has the same height as the text boxes.
-
Close and save the report and run it from Object Designer.
Aligning Labels
The label and the data in the No. column are not aligned because both controls have their alignment set to General, which is default. The label is left aligned because it contains text, while the text boxes are right aligned because they contain numbers.
To align labels
-
With the report open in Report Designer, click View, and then click Sections to open Section Designer.
-
Select the No. label and open the Properties window. Set the HorzAlign property to Right.
-
Close and save the report.
-
Run the report in Object Designer and click Preview.
Next Steps
Now you have created a simple customer list based on one table. The next step is to create a more advanced report. For more information, see Walkthrough: Designing a More Advanced Report.
See Also
© 2010 Microsoft Corporation. All rights reserved.