Jump to content
We've recently updated our Privacy Statement, available here. ×
  • How to replace existing data table with an SBDF file from Library in Spotfire® Using IronPython Scripting


    This article explains on how to replace an exisitng data table with an SBDF file source saved in the library. You can follow the below steps to retrieve the Guid of the SBDF file that is required in the included script

    Introduction

    This article explains on how to replace an existing data table with an SBDF file source saved in the library. You can follow the below steps to retrieve the Guid of the SBDF file that is required in the below script

    • Open Library Administrator in Spotfire Analyst and select the SBDF file
    • Right click and select Edit Properties
    • Goto Properties tab and select ID, then do a Ctrl+C to copy and Ctrl+V to paste into a notepad, to use it later

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Framework.Library import LibraryManager, LibraryItemRetrievalOption
    from Spotfire.Dxp.Data.Import import SbdfLibraryDataSource
    from System import Guid 
    
    # First get the LibraryManager service instance.
    manager = Application.GetService[LibraryManager]()
    
    # You will need the GUID of your SBDF file as saved in the Spotfire library.
    MyGuid = Guid('7a154208-4774-4eeb-9f3e-a0d94943ce8c')
    
    # Search the library with the above GUID. If found, replace the data table, else do nothing.
    (found, item) = manager.TryGetItem(MyGuid)
    if found:
        ds = SbdfLibraryDataSource(item)
        Document.Data.Tables["Data Table"].ReplaceData(ds)
     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...