Jump to content

How can a script in an analysis be triggered automatically when the analysis is automated to send an email


Binoy Bhanujan 2

Recommended Posts

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

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

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

  • 1 month later...
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

  • 3 years later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...