How to remove Calculated Columns from a DataTable in TIBCO Spotfire® Using IronPython Scripting

Last updated:
10:22am Jan 16, 2020
Back to main IronPython scripting page

Introduction

Below is a sample script on how to remove all the calcuated columns from a data table

Code Sample

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

from Spotfire.Dxp.Data import *
from System.Collections.Generic import List

dataTable=Document.Data.Tables["dataTableName"]
columnCollection=dataTable.Columns
columnsToRemove=List[DataColumn]()
#Find Calculated Columns
for col in columnCollection:
	if col.Properties.ColumnType==DataColumnType.Calculated:
		print col.Properties.ColumnType
		columnsToRemove.Add(col)

#Remove Calculcated Columns from Column Collection
columnCollection.Remove(columnsToRemove)

 

References

 

License:  TIBCO BSD-Style License