Ok so I’m pretty new to scripting in Python and I’m having trouble figuring this one out.
I have a table full of results and every row has a barcode (stored as a string) included. I’d like to be able to open a popup menu on a selected row and then take the barcode value of that row and then filter the table by that value. I’m just completely lost on how I need to structure this event.
Ok this is what I eventually got to work and it does what I want.
def filter(event)
pDS = system.dataset.toPyDataSet(self.data)
hdr = list(pDS.getColumnNames())
flt = self.data.getValueAt(self.selectedRow, 'Barcode')
filtered = []
for row in pDS:
if row['Barcode']==flt:
filtered.append(list(row))
self.data = system.dataset.toDataSet(hdr,filtered)
menu = system.gui.createPopupMenu(['Isolate Barcode'], [filter])
menu.show(event)
However, I have the Power Table.data bound to a Named Query in polling mode. This means that when that poll is executed, the query overwrites my new dataset. Is there a way to manipulate the column filtering directly through scripting?