Code sample for IronPython Script to insert columns to an existing data table
Introduction
Below is a sample IronPython Script on how to insert columns to an existing data table.
Code Sample
# Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license. from System.Collections.Generic import Dictionary,List from Spotfire.Dxp.Data import DataFlowBuilder, DataColumnSignature, DataType, DataSourcePromptMode from Spotfire.Dxp.Data import * from Spotfire.Dxp.Data.Import import * #Table to add rows from srctable=Document.Data.Tables["sourceTableName"] #Table to add rows to destable=Document.Data.Tables["destinationTableName"] #column matching between two tables map=Dictionary[DataColumnSignature,DataColumnSignature]() map.Add(DataColumnSignature(destable.Columns["columnName1"]),DataColumnSignature(srctable.Columns["columnName1"])) #columns to ignore ignoredColumns=List[DataColumnSignature]() ignoredColumns.Add(DataColumnSignature(srctable.Columns["columnName2"])) settings=AddColumnsSettings(map,JoinType.InnerJoin,ignoredColumns) dataSource=DataTableDataSource(srctable) destable.AddColumns(dataSource,settings)
References
License: TIBCO BSD-Style License
Recommended Comments
There are no comments to display.