Managing scripts in Spotfire
Scripts can be a part of a Spotfire analysis, either included in action mods or added as plain scripts, which provide additional features in an analysis. Depending on how you add and use the scripts, there are a couple of different places where you can review or manage scripts.
About this task
An administrator has further options to control trust. See the Spotfire Server and Environment Installation and Administration guide for more information.
Scripts in an action mod can be managed from the Actions flyout.
All scripts that have been added to an analysis are usually available in all interfaces where you can add a script, for example in the text area (through the Action Control dialog) or in the Script - Act on Property Change dialog. You can add and delete scripts from these places. Some general management can also be done in the Document properties dialog.
Before you begin
Adding scripts that should be run whenever a document property changes its value
- On the menu bar, select
Tip: The Script - Act on Property Change dialog can also be reached from the Properties tab of the Document Properties dialog, or from the Property Control dialog in a text area.
.
- Click on the document property of interest and select Script from the menu.
- In the
Script - Act on Property Change dialog click
Execute the script selected below.
- Under
Available scripts, select a script, or click
Add to add another script.
You can add existing scripts from an action mod file (*.mod), from an action mod in the library, or add a script that has previously been saved in an analysis file, either locally or in the library. You can also define a new script, if you have the required permissions.The Remark field can contain information about whether a script is trusted or not. Scripts that you have created yourself are trusted, and so are scripts saved as trusted to the library by a member in the Script Author group. Scripts from an action mod can be either trusted or not trusted, depending on whether you, or the administrator, have trusted the mod or the signer in advance.Note: Spotfire compares the scripts you are trying to import with already existing scripts. A script whose script body is identical to an existing script will not be imported even if it has a different name.
If you receive an analysis file containing a script directly from another person, the script will be listed as "Not trusted". This does not necessarily mean that the script contains any unsafe material, but you should determine whether you trust the script by inspecting it in the Edit Script dialog. By clicking OK in the Edit Script dialog, the script will be trusted. If you know all scripts are safe, you can go to Manage trust and click Trust all.
However, due to security reasons, scripts cannot be used in a TIBCO Cloud Spotfire web client environment unless they come from trusted action mods. In a Spotfire on premises web client environment, scripts can be executed if they come from trusted action mods or are saved as trusted by a member in the Script Author group. See also Usage of scripts and data functions.
- If the selected script
contains any parameters that need an input, under
Necessary input for the selected script, click
each parameter to modify the input.
Different parameter types have different input settings. You can often choose between adding an input by typing a Value, associating it with a Property or an Expression. For parameters of type visualization, page or data table, you select the object from the current analysis that you want to associate with the selected script parameter.
- When you are done, click OK.
Adding a new script to an analysis
The following steps are used to create a new JavaScript or IronPython script, without necessarily tying it to a text area, an action in a graphical table or KPI chart or to a document property change. See also Adding a script action to a text area or visualization item for some more details and examples about how to use the New Script dialog.
- On the menu bar, select .
- Go to the Scripts tab.
- Decide whether to add a JavaScript or IronPython script by clicking on the appropriate tab.
- Click .
- In the New Script dialog, enter a script, add any parameters and click OK when done.
- Click OK.
Importing scripts from another analysis file
- On the menu bar, select .
- Go to the Scripts tab.
- Click Add and select an analysis, either a local file or an analysis from the library, to import scripts from. All available scripts from the selected analysis will be imported.
- Review, edit or run the imported scripts, as desired.
Deleting a script from the analysis
- On the menu bar, select .
- Go to the Scripts tab.
- Click on the script to delete in the JavaScript or IronPython tab.
- Click Delete.
- Click OK.
Reviewing a script written by someone else
The Review script dialog is usually reached from the Unsigned items section in the Manage trust dialog. It will look sightly different depending on what type of script you are reviewing.
Review the script and click Trust if you are sure that the script is safe to use.