Can someone tell me why the Edit Mode portion of this code won’t work?? The Add Mode portion works just fine, but not the Edit.
[code]varFacilNmbr = event.source.parent.Facility_Number
varProdCodeNmbr = event.source.parent.Prod_code_Nmbr
varProdCode = event.source.parent.getComponent(‘ProductCode’).text
varIng1 = event.source.parent.getComponent(‘Ing1DrpDwn’).selectedLabel
varIng1Pct = event.source.parent.getComponent(‘Ing1_Prcnt’).text
if (varProdCode == “” or varIng1 == “” or varIng1Pct == “”):
system.gui.messageBox(“Please enter Product Parameters”)
else:
if varProdCodeNmbr > 0:
# Edit mode
varProdCodeNmbr = system.db.runPrepUpdate(“UPDATE productcode SET ProductCode, Ing_1, Ing_1_Pct = ?,?,? WHERE idproductcode = ?”,
[varProdCode, varIng1, varIng1Pct, varProdCodeNmbr])
else:
# Add mode
varProdCodeNmbr = system.db.runPrepUpdate(“INSERT INTO productcode (Facility_Nmbr, ProductCode, Ing_1, Ing_1_Pct) VALUES (?,?,?,?)”,
[varFacilNmbr, varProdCode, varIng1, varIng1Pct], getKey=1)
system.nav.closeParentWindow(event)[/code]
Its probably obvious, but I’m sure hung up on it. (Note: Already tried removing the selectedLabel, and that didn’t work either)
Thanks in advance!