I don't believe there's a way to skip a record, other than returning a value that cannot be casted to the field's data type. For example if you're calculating a Double field, you can give it the value "A" if you want to skip it, and you'll get some warning like "could not write value 'A' to output field {my_double_field}" for every single feature that gets skipped. That's
That's obviously super janky and ugly and can give unexpected results since the tool tries pretty hard to cast data types for you. But that doesn't trigger the editor tracking so technically answers your question.
Using arcpy.da.UpdateCursor()
is the cleanest alternative. For your example of only editing polyline features with curves:
with arcpy.da.UpdateCursor(in_table, "SHAPE@") as cursor:
for row in cursor:
geom = row[0]
if geom and geom.hasCurves:
cursor.updateRow(...)
But there are edge cases where that's not possible, for example if your input table has joins. If UpdateCursor
is not an option but SearchCursor
is (as for a joined table), you could first do a search cursor to find all the features you want to update, then select them and do calculate field. For example:
oids_to_update = []
with arcpy.da.SearchCursor(in_table, ["OID@", "SHAPE@"]) as cursor:
for row in cursor:
oid, geom = row
if geom and geom.hasCurves:
oids_to_update.append(oid)
oid_str = ",".join([str(o) for o in oids_to_update])
where = f"OBJECTID IN ({oid_str})"
selection = arcpy.management.SelectLayerByAttribute(in_table, "NEW_SELECTION", where)
arcpy.management.CalculateField(selection, ...)