How to Replace the Information Link Data Source using SourceView in TIBCO Spotfire® Using IronPython Scripting

Last updated:
8:46pm Jul 09, 2020
Back to main IronPython scripting page

Introduction

This article provides a sample script on how to replace the Information Link data source only of a given data table. This helps to replace just the data source and the operation applied on the data table like calculated columns etc remain as is

Code Sample

# Copyright © 2019. TIBCO Software Inc. Licensed under TIBCO BSD-style license.

from Spotfire.Dxp.Data import *
from Spotfire.Dxp.Data.DataOperations import *
from System import Guid
from Spotfire.Dxp.Data.Import import *

table=Document.ActiveDataTableReference

sourceView=table.GenerateSourceView()
#get the dat atbale data source operation
op=sourceView.GetAllOperations[DataSourceOperation]()[0]

#build the data flow
dataSource= InformationLinkDataSource(Guid("94134318-1116-48f0-a250-b74e41a68f1c"),None,"test")
dataFlow = DataFlowBuilder(dataSource, Application.ImportContext).Build()

#replace the data source
if op.CanReplaceDataFlow():
	op.ReplaceDataFlow(dataFlow)

 

References

 

License:  TIBCO BSD-Style License