fc = "permits" for field in arcpy.ListFields(fc): #Specify all none permit fields if field.name != "OBJECTID" and field.name != "Shape" and field.name != "Shape_Length" and field.name != "Shape_Area" and field.name != "GlobalID" and field.name != "HasPermit": with arcpy.da.UpdateCursor(fc, [field.name, "HasPermit"], "NOT " + field.name + " IS NULL") as cursor: #if query is valid, set hasValue variable to 'true' hasValue = 'true' if hasValue == 'true': for row in cursor: row[1] = "YES" cursor.updateRow(row) hasValue = 'false' del cursor, row
fc = "permits" with arcpy.da.UpdateCursor(fc, ["Permit1", "Permit2", "HasPermit"], "NOT Permit1 IS NULL OR NOT Permit2 IS NULL") as cursor: for row in cursor: row[2] = "YES" cursor.updateRow(row) del cursor, row
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.