Find Data in PyDataset

I’m trying to access a PyDataset and I can return the records in the first row but can’t seem to find the records in the second row. Currently the dataset has only 2 rows but will get to about 40.

[code]data = event.source.parent.partsTable
pds = system.dataset.toPyDataSet(data)
next = 1
stringNull = “”
event.source.parent.PT.PartInfo.PN.STR = “p”
event.source.parent.PT.PartInfo.QTY.STR = “q”
resetButton = event.source.parent.getComponent(‘butReset’)
currentCycleTime = event.source.parent.getComponent(‘numCurrentCycleTime’).floatValue
foundFlag = 0
error = 0

if scanEntry == "":
	error = 9
#Enables the Operator to Reset the Cycle using the Barcode Gun.	
elif scanEntry == "4565":
	error = 1
elif processStep == 0:
#Parses the Part Number
	pn = scanEntry.lstrip('event.source.parent.PT.PartInfo.PN.STR')
	event.source.parent.PT.PartInfo.PN.Value = pn
	from java.util import Date
	event.source.parent.PT.StartTime = Date()		
elif processStep == 1:
#Parses the Quantity
	for row in pds:
		if row['part_num'] == event.source.parent.PT.PartInfo.PN.Value:
			foundFlag = 1
		if foundFlag == 0:
			error = 5
			qty = scanEntry.lstrip('q')
			event.source.parent.PT.PartInfo.QTY.Value = qty[/code]

This code works to find the first row but won’t find the second.

The script looks like it should work just fine. How are you determining that it is not reading the 2nd row?

Maybe this is a stupid question but is the value for part_num the same in both rows?

The last part of your script seems a bit redundant the way it is written. Should the part from ‘if foundFlag == 0’ be outside the ‘for row in pds’ loop?