Wednesday, 13 January 2016

arcgis desktop - Replacing NULL values in geodatabase table?


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?



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?


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...