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

Updating a Data on Demand Table using ironPython script


Nikita Belooussov

Recommended Posts

Hi

Is there a way to refresha data on demand table, so that it updates the data to the new selection on the original data table,using a python script I have been trying to use refresh but it doesnt seem to do anything, either when I use it in the script or when i use it maunauly through the data table properties. I tried to use the following links but they dont seem to work in my case:

https://datashoptalk.com/trigger-on-demand-queries-ironpython/

https://community.spotfire.com/wiki/how-refresh-or-reload-data-using-ironpython-script-tibco-spotfire

Here is my code:

from Spotfire.Dxp.Data import DataManager

from Spotfire.Dxp.Application.Scripting import ScriptDefinition

from System.Collections.Generic import Dictionary,List

from System.Collections import ArrayList

from Spotfire.Dxp.Framework.ApplicationModel import NotificationService

import clr

clr.AddReference("System.Windows.Forms")

from System.Windows.Forms import MessageBox

notify = Application.GetService[NotificationService]()

table1 = Document.Data.Tables["Final_Test DoD from FinalSummary (2)"]

scriptDef=clr.Reference[scriptDefinition]()

Document.ScriptManager.TryGetScript("rename",scriptDef)

params=Dictionary[str,object]()

#Document.ScriptManager.ExecuteScript(scriptDef.ScriptCode,params)

def execCallBack(exception,Document=Document,notify=notify,params=params,scriptDef=scriptDef):

if not exception:

Document.ScriptManager.ExecuteScript(scriptDef.ScriptCode,params)

else:

notify.AddErrorNotification("Error refreshing tables","Error details",str(exception))

#DM = Application.GetService(DataManager);

#DM.Tables.Refresh([table1]);

Document.Data.Tables.RefreshAsync([table1],execCallBack)

 

The version of spotfire I am using is 7.11

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