In the TIBCO® Spotfire environment, IronPython scripts are executed as a single transaction. Transaction processing is designed to maintain a consistent state, by ensuring that any operations carried out on the system that are interdependent are either all completed successfully or all canceled successfully. This will however affect the way that your scripts are processed and executed.
When you run an IronPython script in Spotfire, all methods are executed as one transaction.
This means that the following script:
import time period = 25; Document.Data.Tables["firstTable"].Refresh(); time.sleep(period); Document.Data.Tables["secondTable"].Refresh();
...will be executed in the following manner:
First, while parsing through the script:
period = 25; time.sleep(period);
Second, as the transaction gets pushed out:
So, the executions get collected and put in a stack, to be executed as a single transaction in the end. This gives some inherit limitations, for example in the use-case seen above, where the expected sleep doesn't happen between the two table refreshes but before both of them. In this script, the programmer probably wanted to give time for the first table to finish refreshing before starting the refresh of the second table.
As a workaround for the specific use case mentioned above, you can make use of the DataManager service and the DataTableCollection.Refresh method to ensure that all dependencies are taken into account when refreshing. An example of such a script is shown below, where tables are added to the list in the sequence they are dependent to each other:
from Spotfire.Dxp.Data import DataManager DM = Application.GetService(DataManager); DM.Tables.Refresh([table1, table2, etc...]);
Note: The DataTableCollection.Refresh method only considers dependencies between regular data tables, but ignores dependencies for on-demand tables.
TIBCO® Spotfire 5.0.X and below.