On Classic report layouts that use an option variable, you can use the option string of the option variable to determine which option was selected by the end user. 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.

Before you begin this procedure, you must create a layout suggestion for the report. For more information, see How to: Create a Layout Suggestion.

To assign the option string to an integer variable

  1. In the Classic client, on the Tools menu, click Object Designer.

  2. In Object Designer, click Report, select the report that you want to modify, and then click Design.

  3. On the View menu, click C/AL Globals.

  4. In the C/AL Globals window, on the Variables tab, add the following variable.

    Name DataType

    ShowTypeNo

    Integer

  5. Close the C/AL Globals window to save your changes.

  6. On the View menu, select C/AL Code.

  7. In the C/AL Editor, add the following code to the OnAfterGetRecord trigger to assign the option string to an integer value.

      CopyCode imageCopy Code
    IF ISSERVICETIER THEN BEGIN
      ShowTypeNo := ShowType;
    END;
    
  8. On the View menu, click Sections.

  9. Add a hidden text box with ShowTypeNo as the value of the SourceExpr field. For more information, see How to: Add and Identify Hidden Fields.

  10. On the File menu, click Save.

  11. In the Save window, select the Compiled check box, and then click OK.

To use the integer variable instead of the option string

  1. In the Classic client, on the Tools menu, click Object Designer.

  2. In Object Designer, click Report, select the report that you want to modify, and then click Design.

  3. On the View menu, click Layout.

  4. In Microsoft Visual Studio, in the Report.rdlc file, use the integer variable wherever you used the option string, such as in expressions.

See Also