I'm trying to use the updateCursor in ArcGIS Pro 2.4 to populate a new field in my table and can't get it to work. Situation is like this: I have a table with many fields. One of those fields is "Status1". This field contains text values (for example: "No", "Yes", "ABC123" or nulls). What I need to do is to take everything that is a "No" and put it as "Not Completed" while the rest would be just "Completed" in a new field called "Status2"
My code probably is completely wrong. I have no idea how to access a specific field within a featureclass.
with arcpy.UpdateCursor(FC, fields) as cursor:
for row in cursor:
if Status1[0] = 'No':
Status2[0] = 'Not Completed'
else:
Status2[0] = 'Pending'
cursor.updateRow(row)
arcpy.da.UpdateCursor
. Now It depends on how you ordered your field names inside variablefields
, and with if statement, you need to use==
not one=
andStatus1[0]
andStatus2[0]
should berow[0]
androw[1]
assuming `fields = [Status1, Status2]'.