Jump to content
  • How to replace the File DataSource of a Data Table in Spotfire® Using IronPython Scripting


    With Data Table Source View API you have the ability to view the source view of a data table and perform some operations on the data table. Below is a sample script to replace the file data source of an existing data table `

    Introduction

    With Data Table Source View API you have the ability to view the source view of a data table and perform some operations on the data table. Below is a sample script to replace the file data source of an existing data table

    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 Spotfire.Dxp.Data import DataFlowBuilder
    
    table=Document.ActiveDataTableReference
    
    sourceView=table.GenerateSourceView()
    #get the dat atbale data source operation
    op=sourceView.GetAllOperations[DataSourceOperation]()[0]
    
    #build the data flow
    dataSource= Document.Data.CreateFileDataSource(r"C:D121-02 Open-Perfect Format.csv")
    dataFlow = DataFlowBuilder(dataSource, Application.ImportContext).Build()
    
    #replace the data source
    if op.CanReplaceDataFlow():
    	op.ReplaceDataFlow(dataFlow)
     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...