Jump to content

Delete rows with specific values in the column by selecting multiple data tables.


Heeyeon Kim

Recommended Posts

Hello.

I want to delete rows with specific values in the column by selecting multiple data tables.

I repeated the following script for each table and tried to delete rows of the same condition in several tables.

However, it failed because the script did not work continuously.

Is there a way to select multiple tables at once, or select tables on the current page at once

--------------------------------------------------------------

#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["GMES Coater - Sheet1"]

# Reference to the Column of the Table

dataValuesCursor=DataValueCursor.CreateFormatted(dataTable.Columns["RemoveRows"])

rowsToRemove=IndexSet(dataTable.RowCount,False)

 

for row in dataTable.GetRows(dataValuesCursor):

#Statement to remove or keep rows.

if dataValuesCursor.CurrentValue=="False":

rowsToRemove.AddIndex(row.Index)

 

dataTable.RemoveRows(RowSelection(rowsToRemove))

 

#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["GMES RP_Total - Sheet1"]

# Reference to the Column of the Table

dataValuesCursor=DataValueCursor.CreateFormatted(dataTable.Columns["RemoveRows"])

rowsToRemove=IndexSet(dataTable.RowCount,False)

 

for row in dataTable.GetRows(dataValuesCursor):

#Statement to remove or keep rows.

if dataValuesCursor.CurrentValue=="False":

rowsToRemove.AddIndex(row.Index)

 

dataTable.RemoveRows(RowSelection(rowsToRemove))

 

#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["GMES Slitter - Sheet1"]

# Reference to the Column of the Table

dataValuesCursor=DataValueCursor.CreateFormatted(dataTable.Columns["RemoveRows"])

rowsToRemove=IndexSet(dataTable.RowCount,False)

 

for row in dataTable.GetRows(dataValuesCursor):

#Statement to remove or keep rows.

if dataValuesCursor.CurrentValue=="False":

rowsToRemove.AddIndex(row.Index)

 

dataTable.RemoveRows(RowSelection(rowsToRemove))

 

#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[" - Sheet1"]

# Reference to the Column of the Table

dataValuesCursor=DataValueCursor.CreateFormatted(dataTable.Columns["RemoveRows"])

rowsToRemove=IndexSet(dataTable.RowCount,False)

 

for row in dataTable.GetRows(dataValuesCursor):

#Statement to remove or keep rows.

if dataValuesCursor.CurrentValue=="False":

rowsToRemove.AddIndex(row.Index)

 

dataTable.RemoveRows(RowSelection(rowsToRemove))

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...