1

Have a gdb with 13 FCs and 70 Fields in each FC (same fields). Some fields have 'Null with <> around', which I would like to remove. (Not the field itself or data point. As in set null to empty "")

The only way I can think of doing this is by:

enter image description here

and supplycode provided by here by esri

However I would need to do this 70! times. Is there a more efficient way of doing it?

2

Yes, use ArcPy. The tricky part is to only list the feature classes and fields you want to change.

This example will list all feature classes in the workspace that startswith Testnull. All string/text fields will then be listed and None values replaced with empty strings.

Make sure to backup your data Before you try it. Modify and execute in the python window of ArcMap.

import arcpy
arcpy.env.workspace = r'C:\Default.gdb' #Change to your database

featureclasses = [feature for feature in arcpy.ListFeatureClasses() if feature.startswith('Testnull')]
#featureclasses = arcpy.ListFeatureClasses() #Use this line to list all feature classes in workspace

for fc in featureclasses:
    fields = [f.name for f in arcpy.ListFields(fc) if f.type=='String']
    with arcpy.da.UpdateCursor(fc,fields) as cursor:
        for row in cursor:
            row = ["" if v is None else v for v in row] #If value is none, replace with empty string, else reuse the value
            cursor.updateRow(row)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.