Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
APPLIES TO: Business Central 2022 release wave 1 and later
When you create a new report, there are two tasks main tasks. First, you define the report dataset of data items and columns. Then, you design the report layout. You can use the Report Object and Report Extension Object to define reports in AL. When you define the layout section of a report, there are two ways to do that.
- In versions prior to Business Central release wave 1, layout definitions support the use of one RDL layout and one Microsoft Word layout per AL object and you then specify which report layout type is the default. we'll refer to this syntax as the legacy layout in this article.
- From version Business Central release wave 1, the
rendering
section within the AL object allows you to specify multiple named layouts in the object and you specify the default layout by name and not by type. Note: Therendering
syntax is the recommended syntax to use.
The development environment contains a code action that can convert the legacy layout definition into the new rendering
section for easy update during application update. To use this code action, you must enable code actions in Visual Studio Code. For more information, see AL Language Extension Configuration.
Rendering section
The rendering
section consists of one or more named layout declarations.
Layout declaration in AL
When you declare a layout in AL, the properties Type and LayoutFile are mandatory, whereas the properties Caption and Summary are optional, but recommended. The application will show the translated caption and summaries to the end-user, with fallback to the layout name in case the caption is undefined. For more information, see Defining Multiple Report Layouts.
The MimeType property is only supported if the Type
is declared as Custom
, and is a free-text string.
It's recommended that it follows the standard naming for MIME types or is set to a path equivalent to: Application/Report/<ExtensionName>
where <ExtensionName>
is a short-form that identifies the owning extension. When custom-render layouts are being copied by users for customization, the MIME type follows the layout and can be verified during selection.
The syntax is as follows:
layout(name)
{
Type = RDLC | Word | Excel | Custom;
LayoutFile = <file name>;
Caption = <string>;
Summary = <string>;
MimeType = <string>;
}
Sample code
Sample code for the legacy layout declaration
The legacy layout declaration consists of three report properties as shown in the sample below. The report must specify at least one of the supported formats unless it's a processing only report. The sample defines both an RDLC and a Microsoft Word report layout and sets the default type to Word.
report 50000 "Standard Report Layout"
{
RDLCLayout = './StandardReportLayout.rdlc';
WordLayout = './StandardReportLayout.docx';
DefaultLayout = Word;
}
Sample code for the new layout declaration
The new layout declaration moves the layouts to a rendering section, which must be declared just after the request page section in the report object. The default layout is specified by name using the DefaultRenderingLayout property.
report 50000 "Standard Report Layout"
{
DefaultRenderingLayout = RDLCLayout;
...
rendering
{
layout(RDLCLayout)
{
Type = RDLC;
LayoutFile = './StandardReportLayout.rdlc';
Caption = 'Standard Report Layout (RDL)';
Summary = 'Legacy layout';
}
layout(WordLayout)
{
Type = Word;
LayoutFile = './StandardReportLayout.docx';
Caption = 'Standard Report Layout (Word)';
Summary = 'Standard layout suitable for user facing documents.';
}
}
}
Related information
Multiple Report Layouts Default Rendering Layout Property RDLC Layout Property Word Layout Property Default Layout