Jump to content
  • How to Reload Individual Data Operations in Spotfire® Using IronPython Scripting


    Sometimes it is useful to be able to reload individual data operations, for example linked or stored data sources, in an analysis. Although this is possible from the Data Canvas UI, you may want to have this accessible as reload buttons in a text area. This would also enable Spotfire Consumer web client users to perform reload. In TIBCO Spotfire 10.1 a reload option was added in the API.

    Introduction

    Sometimes it is useful to be able to reload individual data operations, for example linked or stored data sources, in an analysis. Although this is possible from the Data Canvas UI, you may want to have this accessible as reload buttons in a text area. This would also enable Spotfire Consumer web client users to perform reload. In Spotfire 10.1 a reload option was added in the API.

    The example below shows a simple example that reloads one of the data sources from a Text Area action control. It also displays the last reload date in a property control. The example can easily be adapted to match the data sources of your analysis file, for example, to reload another data source or add reload buttons for multiple data sources.

    converted-file.png.38beeceb96f0b451b0ad31b4e01cae14.png

    Code sample

    # Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Data import *
    from Spotfire.Dxp.Data.DataOperations import *
    from System import *
    
    # Get the first data source from the Source View
    op = table.GenerateSourceView().GetAllOperations[DataSourceOperation]()[0]
    
    # Reload data source
    op.Reload()
    
    # Set current time as latest reload
    Document.Properties["lastReload"] = DateTime.Now
     

    Since a data reload can take significant time to complete, it can be convenient to show a progress bar to the user. See Progress bar and cancellation option for how to do this in an IronPython script.

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...