Hi,
I’m struggling a little with PyDataSets.
I’m trying to check if a row is already in a table and adding to it if not, but i’m not sure the best way to do this (I can do it stupidly using for loops, but would like to use the ‘in’ statement).
ds = system.tag.read("System/Mobile Client Sizes").value
pds = system.dataset.toPyDataSet(ds)
***if [size.width, size.height] not in pds:***
ds = system.dataset.addRow(ds, 0, [size.width, size.height])
system.tag.write("System/Mobile Client Sizes", ds)
the *** part doesn’t work.
A couple more questions:
-
how do I not pass in the rowIndex parameter so that it adds the row onto the end? The function description says that this argument is optional and will default to adding the row to the end, however the function doesn’t take keyword arguments, so i’m not sure how to skip this in the argument passing?
-
How would I check if a value exists in a single PyDataSet column? e.g. if
"Bob" in pds["Name"]
?
Thanks in advance!