Jump to content
We've recently updated our Privacy Statement, available here. ×
  • How to Refresh or Reload Data using IronPython script in Spotfire®


    It is a very common scenario wherein a user wants the ability to Reload Data (Linked to Data Source or Embedded) on a script action control. Below are possible ways to refresh a single or multiple Data Tables using Python Script.

    Introduction

    It is a very common scenario wherein a user wants the ability to Reload Data (Linked to Data Source or Embedded) on a script action control. Below are possible ways to refresh a single or multiple Data Tables using Python Script.

    Code samples

    Spotfire® 10.3 or later:

     # Copyright © 2019. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.
     
     # Reload all data in all tables
     Document.Data.Tables.ReloadAllData()
     
     # Reload only linked data in all tables
     Document.Data.Tables.ReloadLinkedData()
     
     # Reload on-demand data in all tables
     Document.Data.Tables.RefreshOnDemandData()
     
     # Reload all data in a specific table
     Document.Data.Tables["table1"].ReloadAllData()
     
     # Reload only linked data in a specific table
     Document.Data.Tables["table1"].ReloadLinkedData()
     
     # Reload on-demand data in a specific table
     Document.Data.Tables["table1"].RefreshOnDemandData()
     

    TIBCO Spotfire® 10.2 or earlier:

     # Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.
     from System.Collections.Generic import List, Dictionary
     from Spotfire.Dxp.Data import DataTable
     from System.Collections import ArrayList
     
    # Refreshing a single Data table (dataTable is a script parameter of type DataTable)
    dataTable.Refresh()
     
    #Refreshing multiple tables.  Note that more than one table can be added to the List
    object. tables = ArrayList()
    tables.Add(Document.Data.Tables["DataTable1"])
    tables.Add(Document.Data.Tables["DataTable2"])
    Document.Data.Tables.Refresh(tables)
     
    #As such DataTableCollection.Refresh Method refreshes the given tables in dependency order.
    #OR
    Document.Data.Tables.RefreshAsync(tables)
    #And DataTableCollection.RefreshAsync Method (IEnumerable< DataTable> ) refreshes the given tables in dependency order. 
    #Tables that have asynchronous refresh (i.e. Data On Demand and Data Functions) and tables that depend on them will be refreshed 
    #in later transactions.
    
    # Another possible option:
    
    Tbls = List[DataTable]() 
    Tbls.Add(Document.Data.Tables["DataTable1"]) 
    Tbls.Add(Document.Data.Tables["DataTable2"]) 
    for i in Tbls:
        Document.Data.Tables.Refresh([i])
    
     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...