Product: TIBCO Spotfire®
How to execute an IronPython script on Filter/Marking change.
Out of the box, it is not possible to execute an IronPython script when Filter or Marking changes. However, we can use Data Functions and Document Properties to achieve this. Document Properties can trigger IronPython scripts when their value changes. We will leverage this feature. High level and detailed steps are described below
.
High level steps.
1. Create a dummy data function that runs when filter changes.
2. Associate the output value of this data function to a document property.
3. Associate the script to this Document Property so it will be triggered when the document property changes.
Detailed steps:
1. Edit >> Data Function Properties
1. Click on "Register New"
2. Name: triggerOnFilterChange
3. Type: R Script - TIBCO Enterprise Runtime for R
4. Description: Data function to pass value of x to y and current time to z
5. Script: (#Here we are just passing the value of x to y, and then current time to z)
This way we ensure that the function is triggered when x, which is based on Filter, changes
y <- x
z <- Sys.time()
6. Input Parameters >> Add >> x, Allowed Data Types: Integer
7. Output Parameters >> Add >> y and z
2. Run
3. Edit Parameters
1. Check the "Refresh Function Automatically" checkbox
2. Input #Input will come from the filter/marking. Make changes in the expression as needed.
1. Input Handler: Expression
2. Data Table: Your data table
3. Expression: Count([Your table].[Column of choice])
4. Limit By: Filtering scheme #Choose marking if you want to trigger script based on Marking
3. Output
4. Select y
1. Output Handler: Document Property
2. New, DocProp1
5. Select z
1. Output Handler: Document Property
2. New, DocProp2
4. Ok
5. Close #Save to Library if you wish to
6. Edit >> Document Properties >> Properties
1. Select DocProp2
2. Script >> Execute the script selected below
3. Select the script you want to execute, OK
execute script on filter change, filter change, execute script, TERR, data function, Sys.time, Data Function Properties, Document Properties
Comments
0 comments
Article is closed for comments.