Execute data table refresh after data function has completed execution

Hi,

I've seen many posts on how to trigger a data function after refresh of a data table is completed and made extensive use of that. But now I need to trigger a TERR data function "GaussConvolution" and once it has copmleted (output is data table "Writing_Density_Data") I'd like to refresh data table "star_kpi_Writing_Density" (which uses data from various tables incl. "Writing_Desnity_Data" and is set to manual update for performance reasons).

I do have an IronPython script which triggers the refresh of data table "star_kpi_Writing_Density" and is called "RefreshStarKpiWritingDensity".

I was trying to modify a script I got from the community and which is originally designed to trigger a script after a data table refresh but it reliably crashes SPOTFIRE 7.11 so I guess something is pretty wrong in my script. Any hints would be highly appreciated...

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("RefreshStarKpiWritingDensity", 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 star_kpi_Writing_Density data table","Error details",str(exception))

from Spotfire.Dxp.Data.DataFunctions import DataFunctionExecutorService, DataFunctionInvocation, DataFunctionInvocationBuilder
dataManager = Document.Data
app = Application
dataFunction = None
for function in dataManager.DataFunctions:
	if function.Name == 'GaussConvolution':
		dataFunction = function
		dataFunction.Execute(execCallBack) 

Thanks,

Mark

 

(1) Answer

Login