Report development is completely different from what it used to be. The report development experience changed in Dynamics NAV 2009 with the introduction of the Report Definition Language Client-side (RDLC) report, but it changes again with the actual release of the application.
With Dynamics NAV 2009, RDLC-based reports were introduced, but reports were still compatible with the classic definition of reports in Dynamics NAV. RDLC reports were actually based on the classic definition of the report.
From Dynamics NAV 2013, the reports classic definition has disappeared and only RLDC-based reports are available. This is why the report development experience has changed again. It now resembles the development experience of pages, queries, or XMLPorts.
Creating reports includes designing both the business logic that covers the kind of information the report will contain, and the layout that deals with how the report will look when it is printed.
In Microsoft Dynamics NAV 2016, to design a client report definition (RDLC), you design the data model with Report Dataset Designer and the layout with Visual Studio Report Designer. To do this, Visual Studio 2010 Professional or above is required.
Visual Studio Report Designer offers several new options and features. Furthermore, due to its thorough integration with Microsoft SQL Server, it is possible to take advantage of the reporting capabilities of Microsoft Report Viewer, including the following:
A report object is composed of a report dataset and a visual layout. You design a report by first defining the dataset and then designing the visual layout. The report objects also contain properties, triggers, code, and an optional request page.
The following diagram shows components of a report and how they are related in Microsoft Dynamics NAV:
Reports in Dynamics NAV 2016 are executed in two steps, which reflect the two steps in the report design. The first is the data set design in C/SIDE followed by report layout design in Visual Studio.
The C/AL runtime retrieves the data from the involved source tables, performs the necessary calculations, and combines the data in a single flattened dataset. This is performed by the NAV server. The produced dataset is transferred to the report viewer's runtime hosted on the NAV client, which, in turn, renders the dataset data according to the report layout definition.
The dataset is defined on the Report Dataset Designer in the Microsoft Dynamics NAV Development Environment. The report dataset is built from data items and columns. A data item is a table. A column can be one of the following:
Typically, the data items correspond to the fields in a table. When the report is run, each data item is iterated for all records in the underlying table with an appropriate filter defined.
When a report is based on more than one table, you must set relations between the data items so you can retrieve and organize the data. In Report Dataset Designer, you indent the data items to establish a hierarchy of data items and control how the information is gathered.
For example, to create a report that displays a list of customers and lists the sales orders that were placed by each customer, you must define the following data items:
Customer
tableSales Line
tableYou indent the second data item, which is the Sales Line
table. As the report works through the records in the Customer
table, it finds each customer's sales orders by examining the records in the Sales Line
table that's related to the customer number.
The following screenshot shows the dataset definition of Report 108 Customer – Order Detail:
You build the visual layout of a report by arranging the data items. A report that is displayed or printed must have a client report definition (RDLC) layout. You use Visual Studio Report Designer to design the RDLC layout. You generally display most data in the body of a report, and you use the header to display information before any data item record is displayed. For example, you can display a report title, company, and user information in the header of a report.
With Visual Studio Report Designer, you can add useful features to your report layouts, such as:
A report in Visual Studio always has exactly one body, and it is not possible to add more than one. Optionally, it can have one page header and one page footer. Extra headers or footers cannot be added. However, you can dynamically change the visibility property of objects on the report layout to control how the report will look.
When the report runs, it first runs the page header, then the page body, and then the page footer. It will not run the page body for each record. Looping through records is done by using a data region in the body section.
Reports use a variety of report items to organize data on a report page. The design surface is not what you see is what you get. The report items have an initial layout position that can change when the report is processed. The following list describes typical uses for different report items:
The following screenshot shows the layout definition of the 108, Customer – Order Detail report: