How to delete marked rows based on certain condition using IronPython

Hello there,

I've been trying to find a way to delete a marked row(s) where one of the columns matches a specific value. In this case, I want to allow deleting rows only when a "username" attribute matches the current username. Here's what I have so far:

from Spotfire.Dxp.Data import *
from System.Threading import Thread

#assign marked rows into variable
selectedRows = Document.Data.Markings["Marking"].GetSelection(Document.Data.Tables["MyTable"])

#create data cursor on a the "Username" column
cursor = DataValueCursor.CreateFormatted(Document.Data.Tables["MyTable"].Columns["Username"])

#loop through the column rows, then retrieve the values and then check against current username.
for row in table.GetRows(cursor):
	value = cursor.CurrentValue
	if value == Thread.CurrentPrincipal.Identity.Name:

Anyone know the right way to do this?

Would appreciate any help!



(2) Answers