4

I need help achieving the task described in the thread title. Let me provide some background:

I am developing a very large dashboard on spotfire that loads a lot of data for visualization. Some of those tables need to be loaded sequentially because of dependencies between them, but others can just be load simultaneously.

For the sequentially loaded tables, I use the following script:

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

# Empty list to hold DataTables
Tbls = List[DataTable]()

Tbls.Add(dt1) #dt1 a DataTable string parameter 
Tbls.Add(dt2) #dt2 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["lastReload"]
  print "OK"
 else:
  notify.AddErrorNotification("Error refreshing table(s)","Error details",str(exception))

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

For tables with no dependancies, I used the following simple script:

from System.Collections.Generic import List, Dictionary 
from Spotfire.Dxp.Data import DataTable 
from System.Collections import ArrayList

dt3.Refresh()
dt4.Refresh()
dt5.Refresh()

I tried simply combining the scripts into a single one but the result was that all tables loaded sequentially.

With the naming used in these scripts, I would like the script to execute as follows:

  1. Load dt1
  2. Wait for dt1 to be fully loaded
  3. Load dt2
  4. Wait for dt2 to be fully loaded
  5. Load dt3, dt4 and dt5 all at the same time.

Best regards, and thanks in advance

MR

Mario Reyes
  • 385
  • 1
  • 2
  • 13

1 Answers1

2

I don't believe it's possible to load data tables simultaneously in Spotfire.

it's certainly not possible through code: IronPython runs single-threaded and, while it's theoretically possible to add threading, you will be wasting a ton of development time to do so for, really, little gain (or maybe a ton of gain if you can package the solution and sell it to TIBCO engineering haha)

I also suggest to allow Spotfire to handle loading data with existing features unless you have some really strange scenario, in which case you probably need to review your approach because you're doing something far, far outside the intentions of the platform.

anyway, all that said, it sounds like you would benefit from loading data "on demand" as the feature is called in Spotfire:

When an information link or a data table from a data connection is to be added to the analysis as a new data table, you have the option to either load all data at once, or to load data on demand only. Your analysis can benefit from on-demand loading when you have access to massive amounts of data, but you only need to work with some parts of the data at a time. When setting up an on-demand data table you can specify conditions based on one or more other data tables to control what to load. You can also start by letting an on-demand data table be the first (or only) data table in the analysis if its input is defined by a document property.

using this functionality, you can have data tables be loaded on triggers such as:

  • marking change
  • filtering change
  • custom expression conditions are met
  • document property change

you can find more information about on demand tables in the Spotfire documentation.

niko
  • 3,946
  • 12
  • 26