Scripts are currently tied to buttons in the text area and they have to be triggered by the user. It should be possible to execute a script as a response to some application event like data reload, marking changes or visualization axis changes. This would make it possible to add more complex behaviors to a Spotfire application that can't be specified declaratively.
YESSSS!!!!!! This is great.and exactly what we need. I just wish it was OOB because it will take some time to get this through our security deployment process for extensions (before I can get my hands on it).
A Data Function recently published on TIBCO Community Exchange allows you to trigger IronPython scripts for the following events:
The initial opening of an analysis file
A Marking or Filtering selection change
A Document, Table or Column Property change
For more information, read https://community.tibco.com/wiki/custom-datetime-data-function-tibco-spotfirer
Download the extension at: https://community.tibco.com/modules/custom-datetime-data-function-tibco-spotfire
On slider move
OnFilter, OnPageChange, OnMark, OnUnmark, OnActivatePage, OnDeactivatePage, OnResetFilters etc.
+ vote for the idea. Another workaround is to use Calculated Value and put 'DOMSubtreeModified' event listener in JavaScript code. Somehow Spotfire contains the events mechanism for R and Javascript but not for the Spotfire model itself. At the end it is enough to make analog of Calculated Value (but changing Document Property directly) and this should be enough to execute a script. For example, Calculated Value in the Text Area is not required any more since it the suggested idea + "Label" to the property will do the same functionality and even more.
I agree with Boris, the current work-around adds complexity and delay.
The IronPython script cabability (on its own) should have the same options to trigger that a data function has: Filtering and Marking.
It is a badly needed feature. The workaround of executing TERR script to launch IronPython script adds unnecessary delay and complexity. It takes seconds for Web Player to Stats Server round trip for no reason other than to launch an IronPython script.
or in the event a user changes the color of an entry in a legend.
...or filter changes
I give a big HELL YEAH for this capability.
Execute script on page load would also be useful in some scenarios. would like to have this feature in Spotfire.
Agree with Hector - the flow for auto running scripts is:
Data Function (auto refresh=true) output to -> Document Property -> Script on Document Property value change -> propagate out to other doc properties from there OR call other scripts from within first script.
There is a work-around using a TERR data function and property that triggers an IronPython (because TERR data functions can listen to filters an markings). To a Spotfire user, this work-around is very clunky and requires Stat Services to run on the Web.
IronPython scripts need to have the same ability to listen to a filter or marking as a TERR data function or allow for an IronPython data function.