Hey guys,
Just thought I’d post this since it took me a while to figure out, thought it may come in useful for someone else.
Here is a script I wrote on a button to search through data in a table and automatically select that row. The find variable is from a numeric entry box (but could easily be a text box or drop down or whatever), the index in the function is what column to search through (0 is the first column, 1 the second, etc…).
[code]table = event.source.parent.getComponent(‘Table’)
data = system.dataset.toPyDataSet(table.data)
find = event.source.parent.getComponent(‘Numeric Text Field 1’).intValue
def getIndexOfTuple(l, index, value):
import system.gui
for pos,t in enumerate(l):
if t[index] == value:
return pos
system.gui.errorBox("Sequence Number not found in selected data!","Sequence Number Not Found")
ndx = getIndexOfTuple(data, 1, find)
if ndx != None:
event.source.parent.getComponent(‘Table’).selectedRow = ndx[/code]