How to trigger an Iron Python Script when loading an analysis as part of a task through Automation Services Job

How to trigger an Iron Python Script when loading an analysis as part of a task through Automation Services Job

book

Article ID: KB0074755

calendar_today

Updated On:

Products Versions
Spotfire Automation Services 7.11 and Higher

Description

It is quite often a requirement that a user may want to trigger an Iron Python Script when an analysis is opened as part of an Automation Services Job, before performing further tasks (Export Report to PDF, Send Email, Save Analysis etc).

Issue/Introduction

How to trigger an Iron Python Script when loading an analysis as part of a task through Automation Services Job

Resolution

There isn't any direct method as such for this, however using the configuration block section of the 'Open Analysis From Library' task, we can easily update any given Document Property which in turn shall trigger an Iron Python script.
Below is a sample Job XML with just a single Task as 'Open Analysis from Library' along with a configuration block section:
 
<?xml version="1.0" encoding="utf-8"?>
<as:Job xmlns:as="urn:tibco:spotfire.dxp.automation">
  <as:Tasks>
    <OpenAnalysisFromLibrary xmlns="urn:tibco:spotfire.dxp.automation.tasks">
      <as:Title>Open Analysis from Library</as:Title>
      <AnalysisPath>/Introduction to Spotfire</AnalysisPath>
      <ConfigurationBlock>myFlag={True};</ConfigurationBlock>
    </OpenAnalysisFromLibrary>    
  </as:Tasks>
</as:Job>

How to trigger script on property change:
Start by creating the property that triggers the script. Go to [Edit > Document Properties > Properties tab > New...]. Select the new script in the available properties list and click the 'Script...' button. Select 'Execute the script selected below' and select the script you want to execute.
 

Additional Information

Details on Script – Act on Property Change
https://docs.tibco.com/pub/sfire-analyst/latest/doc/html/en-US/TIB_sfire-analyst_UsersGuide/other/other_details_on_script_act_on_property_change.htm

Create a Configuration Block in TIBCO Spotfire®
https://community.tibco.com/wiki/create-configuration-block-tibco-spotfire

Configuration Block in Automation Services:
https://docs.tibco.com/pub/spotfire_server/latest/doc/html/TIB_sfire_autsvcs_UserGuide/autoservices/topics/open_analysis_from_library.html