4

I was looking for a way to delete rows in my Data table on SPOTFIRE and I didn't find a proper way to do it.

I tried to code a script to do it, but It's too slow and I have more the 20k rows to be deleted.

Does someone have an idea why it's too slow and if there is a another way to do (a faster way)

from Spotfire.Dxp.Data import RowSelection
table=Document.Data.Tables["my Table name"]
i=0
for row in table.GetRows():
  i+=1
  rowToDelete=Document.Data.Tables["my Table name"].Select("[index]="+`i`).AsIndexSet()
  Document.Data.Tables["my Table name"].RemoveRows(RowSelection(rowToDelete))
Ayyoub
  • 1,315
  • 1
  • 16
  • 37
  • what's your use case? why are you trying to delete from the data table? – niko Nov 30 '16 at 09:09
  • I have multiple dataTable embeded in Spotfire, and a Global DataTable that is based on the Embeded DataTable. I need to delete Data from One Data Table, so i can do just a refresh to on the Global DataTable without re-creating the global DataTable and insert all the rows from the temps tables. – Ayyoub Nov 30 '16 at 15:33

1 Answers1

9

I found a way which is more simple to do it.

from Spotfire.Dxp.Data import RowSelection, IndexSet
dtTarget = Document.Data.Tables["my Table name"]
dtTarget.RemoveRows(RowSelection(IndexSet(dtTarget.RowCount,True)))
Community
  • 1
  • 1
Ayyoub
  • 1,315
  • 1
  • 16
  • 37