Report.FormatRegion([Text]) Method

Version: Available or changed with runtime version 11.0.

Gets or sets the current format region setting for the report.

Syntax

[CurrentFormatRegion := ]  Report.FormatRegion([FormatRegion: Text])

Note

This method can be invoked using property access syntax.

Parameters

Report
 Type: Report
An instance of the Report data type.

[Optional] FormatRegion
 Type: Text
The new format region setting for the report.

Return Value

[Optional] CurrentFormatRegion
 Type: Text
The current format region setting for the report.

Example

If you have reports that you want to print using a format that is aligned with the recepient rather than in your own working region, you can add a few lines of code in the report to handle this. In this example we will take the assumption that the format region will be aligned with the language in the current report run and that the report does not have native support for format region. The document is printed in the language that is specified in the Language Code field on the Customer Card page.

In reports that need the multiple document format functionality, you can insert the following AL code as the first lines in the OnAfterGetRecord() trigger on the data item referencing the Customer table (notice that that feature is not limited to the Customer table, other data sources provides similar functionality.):

trigger OnAfterGetRecord()
var
    LanguageSelection: Record "Language Selection";
    Language: Codeunit Language;
begin
    CurrReport.Language := Language.GetLanguageIdOrDefault("Language Code");

    LanguageSelection.SetFilter("Language ID", format(CurrReport.Language));
    if LanguageSelection.FindFirst() then
        CurrReport.FormatRegion := LanguageSelection."Language Tag";
end;

Report Localization
Report.Language
Report Data Type
Getting Started with AL
Developing Extensions