[GIS] Replacing NULL values in geodatabase table

arcgis-10.0arcgis-desktopfield-calculatornullpython-parser

How do you update NULL values within a geodatabase table using the ArcGIS Field Calculator (service pack 4) without changing other values to NULL? I've tried the suggestions on this previous question:

How do you test for a NULL string field in the Field Calculator with Python?

When I run the script it changes everything to NULL.

def RemoveNULL(x):
    if x is None:
        return '0'

RemoveNULL(str(!myxField!))

e.g.

before running script

1
23
NULL
5

after running script

NULL
NULL
NULL
NULL

Can you not use python script on mdb table?

Best Answer

You logic is wrong. The way it reads now, if not null, then put 0. That explains why null is now set to zero. Because if not null, so it it is null then it equals 0.

Can you post more of the code?