Reputation: 73
I want to mark a row based on the value of a document value. For example, I would have a document property KeySet = K2. When I run the IronPython script, the row T2, K2, 2.00 should be marked.
I'm trying to follow
and
https://community.tibco.com/wiki/how-mark-all-filtered-rows-table-using-ironpython-tibco-spotfirer
but I'm not too familiar with IronPython so I don't exactly know how to combine them to work like how I want.
Is this possible? Thank you.
Initial state:
After running the script, T2 is marked.
Upvotes: 0
Views: 2496
Reputation: 73
Following is a sample script reference to mark rows based on document property selection
from Spotfire.Dxp.Data import *
selectedValue=Document.Properties["propertyName"]
#Create a cursor to refer a column which will have the values
table=Document.Data.Tables["tableName"]
cursor = DataValueCursor.CreateFormatted(table.Columns["columnName"])
rowCount = table.RowCount
#empty indexset
rowsToMark = IndexSet(rowCount,False)
for row in Document.ActiveDataTableReference.GetRows(cursor):
rowIndex = row.Index
if cursor.CurrentValue == selectedValue:
rowsToMark.AddIndex(rowIndex)
Document.ActiveMarkingSelectionReference.SetSelection(RowSelection(rowsToMark),table)
Upvotes: 0