How to: Use Option Strings in Multilanguage Implementations
In a client report definition (RDLC) report layout, an option variable is handled as a normal string, not an option string. If you have a multilanguage application, handling the option as a normal string will cause problems in the displayed report. You must manually convert the option string to an integer variable and then use the integer variable in the RDLC report layout.
An example of a report with an option variable that is converted to an integer variable is report 111, Customer - Top 10 List. The request page has an option variable, ShowType, that allows the user to choose to display either Sales (LCY) or Balance (LCY) in the report. The value of the ShowType variable is assigned to an integer variable, ShowTypeNo, in the OnAfterGetRecord trigger.
To assign the option string to an integer variable
In the development environment, on the Tools menu, choose Object Designer.
In Object Designer, choose Report, select the report that you want to modify, and then choose the Design button.
On the View menu, choose C/AL Globals.
In the C/AL Globals window, on the Variables tab, add an integer variable. You use this variable for the integer value of an existing option variable.
For example, in report 111, Customer – Top 10 List, you have an option variable on the request page named ShowType. On the report, you create an integer variable called ShowTypeNo.
Close the C/AL Globals window to save your changes.
On the View menu, choose C/AL Code.
In the C/AL Editor, add a line of code to the OnAfterGetRecord trigger to assign the option string to an integer value.
For example, in report 111, you have the following line of code.
ShowTypeNo := ShowType;
In Report Dataset Designer, add a Column with ShowTypeNo as the value of the Data Source field.
On the File menu, choose Save.
In the Save window, select the Compiled check box, and then choose the OK button.
To use the integer variable instead of the option string in the layout
In Object Designer, choose Report, select the report that you want to modify, and then choose the Design button.
On the View menu, choose Layout.
In Microsoft Visual Studio, in the Report.rdlc file, use the integer variable instead of the option variable, such as in expressions.
In report 111, the ShowTypeNo integer variable is used in expressions on the bar chart and the pie chart.