3.2 Adding Property Script (Expressions)
You can enter a script in any property field that provides an 'Expression' option.

To add a script to a component expression field, follow the steps below:
1. Right-click the component, and select 'Properties' from the context menu. This opens the 'Properties' dialog box.

2. In the 'Properties' dialog box, find the property you wish to dynamically change. (In the example, we use the 'Visible' property under the General tab.)
3. Click the arrow button next to the property you want to modify, and select 'Expression' from the menu. This enables a small 'Edit' button.

4. Click the 'Edit' button. This opens the Formula Editor.

Note: The script must return one of the existing options in the property menu. For the the 'Visible' property, return values must be “Show,” “Hide,” or “Hide on Print and Export.”
5. In the Formula Editor, enter the desired script. For example, the following script hides the component if the user has selected 'Hide' from a RadioButton control, and the current month is March (i.e., the third month).
if ((RadioButton1['selectedObject']=='Hide') &
(CALC.today().getMonth() == 3)) {
"Hide"
}
else {
"Show"
}
To automatically insert a function (such as CALC.today()), click the corresponding option in the 'Functions' list above the edit area. To automatically insert a reference to another component's property, click the corresponding option in the 'Component' list above the edit area

6. Click 'OK' to close the Formula Editor, and click 'OK' to close the 'Properties' dialog box.
Note: An expression script can reference properties of its hosting component without full qualification. E.g., for a script on component “SelectionList1”, 'SelectionList1.selectedObject' and 'selectedObject' refer to the same property.
Expressions must always return permissible values for the corresponding property. For example, if a property requires an integer, an expression that sets that property must evaluate to an integer. If a property requires one of a fixed set of options, e.g., {'Rows', 'Columns'}, then the expression that sets that property must evaluate identically to one of those strings ('Rows' or 'Columns').
See Also
Dynamic Properties, in Dashboard Design, to set properties with Input components.
Matching Dynamic Values to Property Values, in Dashboard Design, for required return values.
Introduction to JavaScript Programming, for information on JavaScript programming.
| << 3.1 Script Evaluation Order | © 1996-2013 InetSoft Technology Corporation (v11.4) | 3.3 Adding Component Script >> |