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 Dynamics NAV multilingual report:
- NAV text constants
Pros: text constants are handy for dynamics NAV 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.
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.
- 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.
- 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.
- 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.
- 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 Dynamics NAV 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:
- 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.
- 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 Dynamics NAV multilingual 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:
- Create a RTC label when
- 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.
Need help with Dynamics NAV multilingual reports or other type of reports?