Select to view content in your preferred language

I am looking to find all fields that have all NULLs in a mxd and turn them off

1428
2
03-11-2016 06:29 AM
DanMacDonald
Emerging Contributor

I this is the code I have tried so far

for lyr in arcpy.mapping.ListLayers(mxd):

...     fields = arcpy.ListFields(lyr)

...     for field in fields:

...         rows = arcpy.SearchCursor(lyr,"","","","")

...         for row in rows:

...             for field in fields.keys():

...                 fields[field].append(row.getValue(field))

I am a newbie trying to get this to run any and all help would be appreciated

Thanks

0 Kudos
2 Replies
DarrenWiens2
MVP Honored Contributor

Is there an error, or what is the problem? What version of ArcGIS are you on?

0 Kudos
DanPatterson_Retired
MVP Emeritus

Is there a need for this from an analysis perspective? Or is this just a preference on presentation?

If is the first, there are ways to handle nulls in data processing and analysis.