Mark rows programatically

#Programatically marks 'Walmart' rows from a Store column 
from Spotfire.Dxp.Application.Visuals import VisualContent
from Spotfire.Dxp.Data import IndexSet
from Spotfire.Dxp.Data import RowSelection
from Spotfire.Dxp.Data import DataValueCursor

#Script parameters:
selectedTag ='Walmart'
ColumnName = 'Store'

#get table reference
vc = vis.As[VisualContent]()
dataTable = vc.Data.DataTableReference

#set marking

#setup rows to select from rows to include
rowsToInclude = IndexSet(rowCount, True)
rowsToSelect = IndexSet(rowCount, False)

cursor1 = DataValueCursor.CreateFormatted(dataTable.Columns[ColumnName])

#Find records by looping through all rows
for row in dataTable.GetRows(rowsToInclude, cursor1):

 aTag = cursor1.CurrentValue

 if aTag==selectedTag: 
  print idx


#Set marking
marking.SetSelection(RowSelection(rowsToSelect), dataTable)

No comments: