Conditionally skip field calculation for certain rows

686
0
07-05-2023 07:13 PM
Status: Open
Labels (1)
Bud
by
Esteemed Contributor

Regarding the field calculator in the ArcGIS Pro attribute table (Python):

It would be great if there were a way to skip calculating a certain record, if certain conditions are met in the script.

For example, a the line doesn't have true curves, then calculate the shape normally. But if the line does have true curves, then skip the field calculation — without editing the row/invoking editor tracking.


I can do something that's close to that. I can return the original value. That works, but it does update the row, which seems unnecessary and invokes editor tracking (which is misleading, since nothing's really changed).

return orig_geom

Alternatively, I've tried return without specifying anything to return. But that sets the shape to null, which isn't what I want.

return

The same thing happens if I omit the return entirely. The shape gets set to null.

I know it would be ideal if I could avoid selecting lines with curves in the first place (in the Attribute Table). But there isn't a way to query for curves using SQL in the Select By Attributes tool. So doing it in the field calculator script seems like the only other option.


Related: https://gis.stackexchange.com/questions/425048/conditionally-skip-field-calculation-for-certain-rows...