Add columns to a report dataset

Completed

After you add a data item to a report, you can add columns to the data item.

A column can be the following entities:

  • A field in a table

  • A variable

  • An expression

Columns correspond to fields in a table. You can use the tcolumn snippet to add a column to a data item:

            column(ColumnName; SourceFieldName)
            {

            }

The column() construct takes two parameters: ColumnName and SourceFieldName.

The SourceFieldName parameter is typically the name of the field in the table. The ColumnName parameter is the name that you give to a column. In many cases, the name will be the same as the name of the field in the table, except for special characters. The ColumnName must be a Common Language Specification (CLS) compliant name.

It's recommended that you only add the columns that are required for the report layout. Adding more columns than absolutely required will increase the size of the dataset and has a negative impact on the performance of the report.

Each data item and column require a unique ColumnName. This requirement means that you can't have two columns or data items with the same name.

The following example fetches the No., Name, City, and Balance LCY columns from the Customer table:

        dataitem(Customer; Customer)
        {
            column(No; "No.")
            {
            }
            column(Name; Name)
            {
            }
            column(City; City)
            {
            }
            column(BalanceLCY; "Balance (LCY)")
            {
            }
        }

A column has several properties. Use the Ctrl+Space keyboard shortcut to view these properties.

Screenshot of the available Column Properties.