Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



If you find this site useful and you want to support, buy me a coffee   to keep this site alive and without ads.

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
marking=vc.Data.MarkingReference

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

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

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

 found=False
 aTag = cursor1.CurrentValue

 if aTag==selectedTag: 
  rowsToSelect[idx]=True
  print idx

 idx=idx+1

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

No comments: