Script to execute an action after loading a table not working on the web client

Hi,

I am using a "standard" IronPython script to execute an action after a data table is loaded as follows:

import clr
from System.Collections.Generic import List, Dictionary
from Spotfire.Dxp.Data import DataTable
from Spotfire.Dxp.Framework.ApplicationModel import NotificationService

Document.Properties["readyToDisplay"] = "No"
# Empty list to hold DataTables
Tbls = List[DataTable]()

Tbls.Add(dt1) #dt1 a DataTable string parameter 
Tbls.Add(dt2) #dt2 a DataTable string parameter 
Tbls.Add(dt3) #dt3 a DataTable string parameter 
Tbls.Add(dt4) #dt4 a DataTable string parameter 
Tbls.Add(dt5) #dt5 a DataTable string parameter 

# Notification service
notify = Application.GetService[NotificationService]();

# Execute something after tables are loaded
def afterLoad(exception, Document=Document, notify=notify):
 if not exception:
  Document.Properties["readyToDisplay"] = "Yes"
 else:
  notify.AddErrorNotification("Error refreshing table(s)","Error details",str(exception))

# Refresh table(s)
Document.Data.Tables.RefreshAsync(Tbls, afterLoad)

The intended behaviour of the script is to set a document property to a value at the start of the script and then set the same property to a different value once the table/s are downloaded. Nothing very fancy, the idea is to use the aforementioned document property to "turn on/off" a visualisation while the download is executing.

This works as intended in my spotfire client, but it does not work in the web player.  The symptom is that the script executes the first document property assignment action (line 6 of the code above) but never executes the second one inside the IF statement (line 21). 

Does anyone have any insight as to why this is so in the web player?

Thanks,

MR

(1) Answer

Login