I am writing a python script geoprocessing tool and need to use an UpdateCursor to populate a text field with either 'Y' or 'N' depending on whether a date field is null or not. Here is my code:
with arcpy.da.UpdateCursor(arcpy.env.scratchGDB + r"/cn42n_table", (cn42n_status_field_validated, cn42n_cancel_date_field_validated, "CANC", "PARC")) as cursor: for row in cursor: if "CANC" in row or not row is None: row = "Y" else: row = "N" if "PARC" in row: row = "Y" else: row = "N"
I have tried several ways of checking if row (my date field) is not null but whatever I try the 'CANC' field is populated with a 'Y'.
Could someone please tell me the correct way to do this?