Jump to content
  • How to remove Calculated Columns from a DataTable in Spotfire® Using IronPython Scripting


    Sample script to remove all the calcuated columns from a data table

    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

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...