I am attempting to update a table so that a field, "ALLREADY", fills with "Y" or "N" depending upon if "dmready" equals "total_records" AND if "dm_stat" is equal to "Ready for DM". When I run my script, all records fill with N, even those that meet the conditions (as you can see from the first record in the screenshot below).
My script:
inTable = os.path.join(env.workspace, "pivotTableTEMP")
with arcpy.da.UpdateCursor(inTable, ["dmready", "total_records", "dm_stat", "ALLREADY"]) as cursor:
for row in cursor:
if row[0] == row[1] and row[2] == "Ready for DM":
row[3] = "Y"
cursor.updateRow(row)
else:
row[3] = "N"
cursor.updateRow(row)
I have double checked that all fields in my script match the column names and that Ready for DM does not have any hidden characters.
dmready
andtotal_records
both the same type? Also double check that you don't have any trailing spaces in thedm_stat
column.