Comparing user input with a PyDataSet

Greetings all. First time poster; and new to Jython user. I hope this is the section for this question.
I have a PyDataSet. I want to see if any entry in the first column matches an input from the user. Here’s my situation: we are installing a kiosk with a touch screen at our fresh fruit receiving area. A truck driver will input his/her truck load number. This goes into a client integer called [Client]LN. I need to scan the first column in the PyDataSet to see if any load number in that column matches the driver’s input. The name of the first column is “load_number”.

Any ideas?

A simple and fairly easy to read solution would be something like this:

[code]clientLN =“PATH/TO/TAG/[Client]LN”).value
match = False
for row in myDataSet:
if row[“load_number”] == clientLN:
match = True

if match:

Thanks Ted!

I can see how the logic should work. However it fails on two counts (I think :open_mouth: ):
When I convert from a database dataset to a pydataset, I think I lose my column names, so “load_number” is not recognized by the interpreter. So I removed the column name thus:

clientLN ="[Client]LN").value
myDataSet = pds
match = False
for row in myDataSet:
if row == clientLN:
match = True


My output on the output screen reads:


I do know one of the load numbers is 86833 so my output should be true. I can’t figure out why it is false. :scratch:

Your pyDataSet should not be losing column names so there should be no issue referencing by column name as I did. Additionally, in your code segment you are comparing the entire row to a numerical value with [tt]if row == clientLN:[/tt] so they’re not going to match at any point.