Binoy Bhanujan 2 Posted March 4, 2016 Share Posted March 4, 2016 I have written a script to change the column names of a graphical table dynamically when ever the source table is updated with latest data. But the script is been triggered by a button added in a text area. I need to automate this analysis and sent this by e-mail. I have created the automation job to Open the Analysis and Send e-mail but I need help in running the script in the analysis without any manual triggering. Link to comment Share on other sites More sharing options...
Sean Riley Posted March 4, 2016 Share Posted March 4, 2016 You can use a data function to trigger the IronPython script on initial load of the analysis. Note: This requires TIBCO Spotfire Statistics Services to work in the Web Player or in Automation Services: Title: How to execute an IronPython script on initial load of an analysis. Description: Normally, IronPython scripts cannot be set to automatically execute when the report is opened. but instead must be manually triggered with an action control button/link or on property change. One method to trigger the script to execute automatically when the report is opened is to use a data function, which does execute when the report is opened, to update a document property which is configured to execute the IronPython script on property change. Environment: Product: TIBCO Spotfire (desktop client / Analyst / Professional)Version: All Supported VersionsOS: All Supported Operating Systems-------------------- Resolution: Step 1. IronPython script to be executed on report load First, create the IronPython script to be executed on report load. For example: Name: ExecuteOnLoadScript: import clr clr.AddReference("System.Windows.Forms") from System.Windows.Forms import MessageBox MessageBox.Show("This script ran automatically on load") Step 2. Document Property which is configured to execute the IronPython script on property change:Create a document property that will be used as the trigger for the IronPython script. For example: This is configured here: Edit > Document Properties > 'Properties' tab > New.. > Give it the name 'CurrentDateTimeProperty' and value '5/21/2015 10:53 AM' (or any valid value). Edit > Document Properties > 'Properties' tab > Select 'CurrentDateTimeProperty' property > 'Script' button. Script - Act on Property Change > Each time the property value changes, perform this action > Select 'Execute the script selected below'. Select the 'ExecuteOnLoad' script to run (or other script that will run on document load). Property Name: CurrentDateTimeProperty Script: ExecuteOnLoad Step 3. Data Function which executes on report load: Create a data function that outputs the system time to a document property 'CurrentDateTimeProperty' as created in Step 2. This executes automatically when the report is opened. This can be created here: Edit > Data Function Properties > Register New Enter a name: Update_CurrentDateTimeProperty In the 'Script' tab, enter the script: output Link to comment Share on other sites More sharing options...
Sean Riley Posted March 8, 2016 Share Posted March 8, 2016 I updated the answer to try and correct some of the formatting issues. Link to comment Share on other sites More sharing options...
Binoy Bhanujan 2 Posted March 11, 2016 Author Share Posted March 11, 2016 Thank you for your response. This has helped me to trigger the ironpython script automatically when I am opening the analysis in the Spotfire Client. But when I schedule my job for the same analysis the script does not seem to work. The automation job I created contains the following tasks: 1. Opening the analysis 2. Saving the analysis 3. Send E-mail The job is run from the Spotfire web service server. Link to comment Share on other sites More sharing options...
Sean Riley Posted April 12, 2016 Share Posted April 12, 2016 The TSSS URL used by the Web Player or by Automation Services is determined based on the 'Preference' as assigned on the group level. Ensure that the user who is being authenticated (either via schedule AS job, or via WP, etc) has that preference defined Link to comment Share on other sites More sharing options...
Sean Riley Posted April 13, 2016 Share Posted April 13, 2016 And is the report cached in Scheduled Updates That can also interfere with the automatic execution of the data function. Link to comment Share on other sites More sharing options...
Hitesh Ganger 2 Posted July 25, 2019 Share Posted July 25, 2019 We have a task that needs to be doen even if the users has not opened the analysis. I created an automation services job for opening the ananlysis. I have also added a config bloack withCurrentDateTimeProperty="{date}{time}"; But still when i test by running it locally it does work but when i test by running on server the script is not triggred. Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted July 25, 2019 Share Posted July 25, 2019 Can you try specifying a space between the data and time like "{date} {time}" and see if it helps Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now