Trigger Script Controls via Property Control changes

Reading Time: 2 minutes

Property Controls have become a very powerful feature for building Guided Analytics in TIBCO Spotfire. When the underlying property attached to that control is used within an expression, the expression will re-calculate automatically when the property value changes. In other instances, when the property will be used in other locations, a Script Control is required to make updates to Spotfire when the property value changes. In Spotfire 6.0, it is now possible to associate a Script Control with a Document Property so that when the Document Property value changes, the associated Script will automatically be triggered. This eliminates the requirement to execute a Script Control by clicking on a button.

Let’s look at an example. Suppose we want the consumer of an Analytic Application in the Web Player to be able to toggle whether to sort a Bar Chart or not. We can create a Drop-down list Property Control which allows the user to select the values True or False.

triggerScript1

This Control is attached to a Document Property. There is a new option for each Document Property where you can associate a Script to it.

triggerScript2

You can do this by clicking on the ‘Script’ button, to either Create a new Script Control or associate an existing Script Control to the Document Property.

triggerScript3

Now the Script is associated, every time the Document Property value changes, the Script will be triggered.