Use Script Objects
As an application designer or story developer, you can use script objects to encapsulate a set of functions that can be reused in scripting.
About Script Objects
A script object is a non-visible part of an analytic application or optimized story, which groups a set of functions. You can use it directly in event handlers. This keeps you from duplicating codes and makes maintenance of applications or stories easier.
-
name
-
return type
-
arguments
You can access the script object in scripts by entering its name like other widgets. Inside the function of a script object you have access to all objects in the application or story such as widgets, global variables and popups.
Create a Script Object and Script Function
Procedure
Results
You've created a script object. You can use it in any widget event handler.
You can add multiple script functions to the script object by selecting Outline panel.
next to it in theExample
The following example displays the elements of the script function computeAverage.-
name: computeAverage
-
return type: number
-
arguments: value1, value2 and value3 (all number type)
-
scripts: return (value1 + value2 + value3) / 3.0;
Modify And Delete Script Objects and Script Functions
To change the name, description, arguments and return type of a script function, select it in the Scripting area of the Outline panel. The panel opens where you can directly update your changes. After you've changed the elements, select Done to close the panel.
To edit an argument, in the Arguments section of the Script Function panel, select (Edit) when hovering over it. To remove an argument, select (Remove) next to it.
To delete a script object or script function, select next to it and then Delete.