Hi, i’m trying to select a result if the query returns a value, , if it does not return a value then do something else. i have it working with this code. but im trying to find a better way. because it does not look good.
selectlog="""select palletid from rawmaterialslog where palletid=? and lotid = ?"""
selectlo=system.db.runPrepQuery(selectlog, [newValue, lotid])
try:
################ if no results when trying to print it will fail, and it will go to Except, and then i run my code from there. but looking to avoid using the print ########
print selectlo[0][0]
system.gui.messageBox(“That Pallet was already Scanned, please choose another”)
except:
Do something.