Trigger multiple data functions in parallel through a Python script

Hi,

I've made extensive use of the community and the TIBCO service (thanks!) to generate a very simple Python script which triggers a TERR data function. I know this can be done w/o Python directly but my ultimate goal was to trigger multiple data functions and a refresh of one data table through a single button.

Anyways, the result so far is a small correction to the above linked community entry and two pieces of Python script which both run fine individually. However, when I combine them ("FIRST PART" and "SECOND PART") in a single script whichever data function is triggered first (i.e. put at the beginning of the combined script) returns no data (and no error). So to me it looks like triggering the second data function somehow cancels the execution of the function triggered first. Any suggestions how to avoid that would be highly appreciated!

########################## FIRST PART ##########################
################################################################
### Download CD-Map Data and, once completed, Trigger CD-Map MBA
import clr
from System.Collections.Generic import List, Dictionary 
from Spotfire.Dxp.Data import DataTable 
from System.Collections import ArrayList
from Spotfire.Dxp.Application.Scripting import ScriptDefinition
from Spotfire.Dxp.Framework.ApplicationModel import NotificationService
# Notification service
notify = Application.GetService[NotificationService]()
# Get second script to be executed after CD-Map data download is finished
scriptDef = clr.Reference[ScriptDefinition]()
Document.ScriptManager.TryGetScript("CD-Map_MBA", scriptDef)
params = Dictionary[str, object]()
# Refresh Callback function
def execCallBack(exception, Document=Document, notify=notify, params=params, scriptDef=scriptDef):
	if not exception:
		# executes the script
		Document.ScriptManager.ExecuteScript(scriptDef.ScriptCode, params)
	else:
		notify.AddErrorNotification("Error refreshing CD-Map (raw) data table","Error details",str(exception))
# Get/Add table(s) to refresh
# Note that more than one table can be added to the List object by repeating the tables.Add() method
tables = ArrayList()
tables.Add(Document.Data.Tables["CD_Map (raw)"]) 
Document.Data.Tables.RefreshAsync(tables, execCallBack)

########################## SECOND PART #########################
################################################################
### Trigger TERR data function to compute CD MBAs
# Datafunction service
from Spotfire.Dxp.Data.DataFunctions import DataFunctionExecutorService, DataFunctionInvocation, DataFunctionInvocationBuilder
dataManager = Document.Data
app = Application
dataFunction = None
for function in dataManager.DataFunctions:
	if function.Name == 'CD_MBA':
		dataFunction = function
		dataFunction.Execute()

(2) Answers

Login