AnsweredAssumed Answered

If Statemente and UpdateCursor

Question asked by ionarawilson on Oct 8, 2013
Latest reply on Oct 9, 2013 by ionarawilson
I am using this code to update only the records that have the field PlanID blank. It works fine if the field shows nothing, but not if it has a null value like <null>. The field type is string ad the data is in SDE. Any ideas? Thank you?

with arcpy.da.UpdateCursor(Input_Polygons, ("DateStart", "PlanID", "FFY")) as rows:               for row in rows:         if row[1] in ("", " ", "None", "Null", "<Null>"): #covers blank, one blank space, or Null            Datestarstr1 = row[0]             Datestarstr2 = str(Datestarstr1)                      yearonly = Datestarstr2[0:4]                               row[2] = yearonly              rows.updateRow(row) 

Outcomes