John Paul Beltran Posted June 10, 2020 Share Posted June 10, 2020 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 https://community.spotfire.com/wiki/how-mark-visualization-based-unmarked-rows-another-visualization-tibco-spotfirer-using and https://community.spotfire.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. Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted June 10, 2020 Share Posted June 10, 2020 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) Link to comment Share on other sites More sharing options...
John Paul Beltran Posted June 10, 2020 Author Share Posted June 10, 2020 Thanks for the help, it works amazing :) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now