Jump to content
We've recently updated our Privacy Statement, available here. ×

Execute data table refresh after data function has completed execution


Mark Herrmann

Recommended Posts

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 TERRdata 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

Link to comment
Share on other sites

Hello Shandilya,

 

thanks for the quick response but SPOTFIRE still crashes. I found another workaround by simply refreshing the output data table of TERR data function "GaussConvolution" and then refreshing the 2nd data table I do not need to trigger the data function explicitly (this happens automatically when refreshing its output data table). So problem solved.

 

 

 

Thanks

 

Mark

Link to comment
Share on other sites

  • 1 year later...

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...