You design a report by first defining the logical structure or data model, and then designing the visual layout.
The report data model is built from data items that each correspond to a table. When the report is run, each data item is iterated for all the records in the underlying table. When a report is based on more than one table, you indent the data items to establish a hierarchy of data items and control how the information is gathered.
To make a report that prints out a list of customers and lists the sales orders placed by each customer, you must define two data items. One data item corresponds to the Customer table and the other corresponds to the Sales Order table. The second data item, in this case the Sales Order table, should be indented. This means that as the report works through the records in the Customer table, each customer's sales orders are found by going through the records in the Sales Order table.
Defining the Data Model
You define the data model by defining how the data is collected. This includes:
Creating data items that define the tables that the report uses.
Defining the relationships between the data items if the report uses more than one table.
Defining the key, sort order, and filters to use with the data items.
Defining how data is grouped.
Defining how totals and subtotals are calculated.
Writing C/AL code in data item triggers, if necessary, to improve the functionality of the report.
Designing the Visual Layout
The visual layout of a report includes the sections. In a printing report (remember that reports do not actually have to print anything), one or more sections are attached to each data item.
There are several types of sections, each with a specific function. Normally, the bulk of the data is printed in the body section of a data item, while the header section is used to print information before any data item record is printed, for example, column captions. But some reports do not use the body section and all the information is printed in other sections.