This chapter explains how to create Custom Options. Custom Options provide a modifiable menu for end users to set values that can be utilized by Custom Functions, Server Events, or the API.
- To add a new Option select ‘Custom Options’ in the Main Menu then click the add button.
- To edit an existing Option either double click it or select it and click the edit button.
- To delete an Option select it and click the delete button.
Custom Options allow for the definition of settings that users can be modify on a per-report basis in the Report Designer. Options can be accessed during report execution by Server Events or Custom Functions.
The name of each option can be controlled on a per-user basis using our multi-language feature. Custom Options can store several types of data such as integer, boolean, text, etc. Each data type provides an appropriate UI element for the user to select a value.
To create a Custom Option, select ‘Custom Options’ in the Main Menu and click the 'Add' button. This will open a Custom Options tab.
Each Custom Option has the following properties:
The unique Id of the option. The Id is used in accessing the option and may be displayed in the Custom Options Menu as the user sets its value on a report.
NOTE. To support multi-language functionality, create an element in the language file(s) with an Id that matches the Option’s Id. The string of that language element will be displayed to the user in the Custom Options Menu. For more information see Multi-Language Support.
The data type the Option should display. Each data type will display an appropriate input element in the Custom Options Menu. The following types are available.
- Int – Represents a whole number.
- Decimal – Represents a decimal.
- Bool – Represents a Boolean value. A checkbox is displayed.
- Text – Represents text and displays a text box.
- List – Represents a choice from among multiple values. Click the 'Add' button to define choices.
After Custom Options are created, the Custom Options Menu will be available in the Report Designer of Standard and Crosstab Reports. In the Custom Options Menu, options can be set using the UI elements displayed above.
NOTE. The Custom Options Menu will only display if Custom Options exist.
The .Net Api, Server Events, and Custom Functions can access Custom Options values through the SessionInfo.Report object by using the following method:
string GetCustomOptionValue(string id)
Returns the value of the specified Custom Option as a string.
For Bool options the value returned will be “true” or “false”.
For List Options, the chosen Id is returned.
NOTE. List options will return the Id of the selected value and not the displayed language string.
A Custom Function could use the following C# code to return the value of a Custom Option. The Id of the Option is entered as an argument of the Custom Function.