The AL developer environment is evolving with frequent updates. To stay up to date on the latest information and announcements, follow us on the Dynamics NAV Team Blog.

Defining a Report Dataset

You use a report object in the AL Language development environment to define the data model, or dataset, of a report. The dataset determines the data that is extracted or calculated from the Dynamics 365 Business Central database tables that can be used in a report. For more information, see Report Object.

You build the report dataset from data items and columns. A data item is a table. A column can be:

  • A field in a table

  • A variable

  • An expression

  • A text constant

Typically, data items and columns correspond to fields in a table. When the report is run, each data item is iterated for all records in the underlying table. Filters are applied and the dataset is created. When a report is based on more than one table, you must set relations between the data items so that you can retrieve and organize the data.

Snippet support

Typing the shortcut treport will create the basic layout for a report object when using the AL Language extension in Visual Studio Code.

Example

The following example adds the Customer table as the data item and the CustomerName and CompanyName as fields of a column to the report. For more information on creating a report, see Creating a Report.

dataset
{
    dataitem(Customer; Customer)
    {
        column(CustomerName; CustomerName)
        {
        }
        column(CompanyName; CompanyName)
        {
        }
    }
}

See Also

Report Object
Reports Overview
Report Design Overview