Creating a Report Dataset in Dynamics NAV
A dataset determines the data that displays on a generated report. You build the report dataset from data items and columns, where a data item is a Dynamics NAV table and a column can be a field in the table, a variable, an expression, or a text constant.
After you create the dataset, you can design the report layout.
To create a blank report and add items to the dataset
In the Microsoft Dynamics NAV Development Environment, on the Tools menu, choose Object Designer.
In Object Designer, choose Report, and then choose New.
In Report Dataset Designer, the first line contains DataItem in the Data Type column. In the Data Source column, either enter a table name or table number, or choose the Assist button to select a table from the table list.
In the Name field of the DataItem line, either enter a name or verify the default name. The name must be a Common Language Specification (CLS)–compliant name. For more information, see the "Naming" section in Common Language Specification in the MSDN Library.
In Report Dataset Designer, on the first blank line, in the Data Type column, select Column from the drop-down list.
In the View menu, choose Field Menu.
The Field Menu window opens, displaying the list of available fields from the data item.
In the Field Menu window, select one or more fields that you want to add to the report dataset. Select multiple fields by holding down the SHIFT key or the CTRL key. Choose the OK button to add the selected fields to the dataset.
If you want to include the caption of a column in the dataset, then select the Include Caption check box in Report Dataset Designer. The caption is included as a parameter in Visual Studio Report Designer.
If the Include Caption column is not visible in Report Dataset Designer, then on the View menu, choose Show Column, select Include Caption, and then choose the OK button.
In Report Dataset Designer, enter data items and columns until you have added all fields from all the tables that you want to include in the report.
If you want to add a label to the report, such as a caption for a table header or a title for the report, then add a label to the dataset. For more information, see How to: Create Labels for a Report.
If you want to include a variable in the report dataset, then do the following:
In Report Dataset Designer, on a blank line, in the Data Type column, select Column from the drop-down list.
In the Data Source column, enter the variable. You can use the up arrow to open the C/AL Symbol Menu dialog box and view the variables for the report.
In Report Dataset Designer, in the Name column, enter a CLS-compliant name for the variable. This name is used in the dataset in Visual Studio.
If you want to include a calculation or other source expression in the report dataset, then do the following:
In the Data Source column, enter the source expression, such as 8*125.
In the Name column, enter a CLS-compliant name for the variable. This name is used in the dataset in Visual Studio.
On the File menu, choose Save.
In the Save As dialog box, in the ID field, enter an ID for the report object. The ID must be in a valid range for your solution. In the Name field, enter a name for the report. Select the Compiled check box, and then choose OK.