Multilingual Reports: Labels vs Text Constants

Ignė Butėnė

Product manager

Topic: Development

Date: 9 Jul 2015

Microsoft Dynamics NAV reports, starting from version 2013, contain multiple ways of storing captions and text constants to handle multilingual reports. There are certain types of reports which are printed cross-language. E.g., multiple sales invoices can be printed in several languages, depending on the customer they are issued for. These reports usually contain code, which dynamically switches between languages during the runtime of the report as follows:

CurrReport.LANGUAGE := <Language Code>

There are several ways of transferring text into a report:

  1. NAV text constants
    Pros: text constants are handy for dynamic multilingual reports as they change language when a language change is triggered.
    Cons: they need to be explicitly added to the dataset to be transferred to the report. Constants end up on each row in the dataset, creating excess data and slowing down the report.
  2. Labels
    Pros: labels are a good feature as they are transferred to static text inside the RDLC report. They are a good alternative to text constants as they provide better performance, not going through the dataset.
    Cons: they are converted to static text inside the report, thus you cannot dynamically change language in the middle of the report execution, because they stay fixed to the initial language.
  3. String constants
    Used in the format of ‘TEXT’ these are not recommended, as they do not provide multilingual capabilities. They are not efficient, because they get repeatedly passed onto the report via dataset, just like text constants. The only occasion when they could be utilized is when you need a language independent constant, like a special character. But even then RDLC text constants (see below) are more efficient to use.
  4. RDLC text constants
    Pros: it is possible to store text constants inside the RDLC layout. These work in the same manner as labels, are performance efficient.
    Cons: they are harder to maintain as you would store them on the RDLC textbox source expressions and labels are easier to locate. They also do not provide multilingual capabilities.
  5. FIELDCAPTION function
    Pros: works the same way as text constants. It provides ability to transfer captions defined for table fields and to effectively use captions.
    Cons: just like text constants, they clutter the dataset and slow the performance of the report down.
  6. IncludeCaption flag
    Pros: this flag is transferring captions of a table field to static text inside the RDCL report, the same way labels do. It works very efficiently and is very easy to maintain and develop.
    Cons: does not work when you need to dynamically change the report language in the middle of execution or you have custom captions for a field.

There are a few guidelines to follow when upgrading Classic Multilingual reports to RTC ones.
When upgrading classic report label control captions to RDLC report, follow these rules:

  1. Create global text constants and add them to the dataset when
    • Label is not linked to a textbox (does not have a parent control).
    • Label or parent control contains a custom CaptionML property.
  2. Create columns in the dataset for all other classic report labels when label has a parent control and CaptionML properties for both controls is not changed, i.e., inherited from the source field. Use the following format to transfer the caption:

<table name>.FIELDCAPTION(<table field name>)

The majority of the reports we have encountered do not need the language to be dynamically switched during the report execution, thus it is wise to follow the guidelines below for best performance, when developing or upgrading reports:

  1. Create a RTC label when
  2. Use “IncludeCaption” property for all labels when label is linked to a parent textbox and “CaptionML” property is inherited (unchanged) for both controls.
    • Classic report label has no parent textbox.
    • Classic report label has a parent textbox and either the label or parent control has a custom CaptionML.

By Karolis Vansevicius, Simplanova Dynamics NAV Developer; Igne Butene, Simplanova Project Manager

About Karolis Vansevicius

Karolis has more than 6 years of experience in Microsoft Dynamics NAV. He specializes in reporting, has proven expertise in classic reports, SSRS reports, BI, upgrading reports to RTC.

Need help with multilingual reports or other type of reports?

Simplanova team can help you with both Microsoft Dynamics NAV report development and upgrades. Write us at [email protected] or call us at +370 673 10712.

  • atis123Juve

    For the NAV Text constants and the FIELDCAPTION function, you can create an integer Dataitem at the end or the beginning of the report, and include all these captions in that. In that case your dataset only contains one row for these captions, and you can always refer to the value with the First, or Last expression based on where you put in the dataset.

SIMPOLANOVA REPORT DESIGNER

Create Dynamics NAV reports quickly and easily just in one NAV page.