This script will remove (or keep) rows based on cell data from a column. If the cell value of the column equals 'Unknow' the ro
Introduction
This script will remove (or keep) rows based on cell data from a column. If the cell value of the column equals 'Unknown' the row will be removed. The comparison '==' could be inverted to instead keep the rows marked 'Unknown'.
Code Sample
#Remove (or keep) rows based on cell data of a row from Spotfire.Dxp.Data import DataValueCursor,RowSelection,IndexSet # Add a reference to the data table in the script. dataTable = Document.Data.Tables["Data Table"] # Reference to the Column of the Table dataValuesCursor=DataValueCursor.CreateFormatted(dataTable.Columns["Origin"]) rowsToRemove=IndexSet(dataTable.RowCount,False) for row in dataTable.GetRows(dataValuesCursor): #Statement to remove or keep rows. if dataValuesCursor.CurrentValue=="Unknown": rowsToRemove.AddIndex(row.Index) dataTable.RemoveRows(RowSelection(rowsToRemove))
References
License: TIBCO BSD-Style License
Recommended Comments
There are no comments to display.