[GIS] Use Round in ArcMap 10.x Field Calculator on field with both numeric and NULL values

arcgis-10.1field-calculator

With older versions of ArcMap (9.3, 9.2, etc) I was always able to round numbers down to 2 decimal places using field calculator even if that field had both numeric values and a bunch of NULL values. It used to just ignore the NULL values. With ArcGIS 10.x this is no longer the case.

round([UPSTREAMINVERT],2)

Rounding a field that has any NULL values leads to error 999999, error executing function – invalid use of Null: 'round'

I realize it works just fine when you remove NULL values from the selection. However, I'd prefer not to have to do this for every field I'd like to have rounded.

Has anyone else experienced this and found a work-around? I've tried to do an if-then statement in field calculator to only return the rounded value if the value is not NULL. This gives the same error message.

Thanks.

Best Answer

I think python uses None instead of Null as in other languages..It Could be the issue. You could do a check if

fieldValue is None

before rounding.