Anyone know how to make fields in a Feature Layer visible or hidden?
Tried using the Field Info object, no luck there...
Tried tossing a RefreshActiveView() onto the end, that didn't help either.
Tried using the Field Info object, no luck there...
Code:
desc = arcpy.Describe("FeatureLayer")
field_info = desc.fieldInfo
visibleFields = ["ID", "NAME", "Rank", "Count"]
for index in xrange(0, field_info.count):
fieldName = str(field_info.getfieldname(index))
if fieldName in visibleFields:
print "Found Field " + str(fieldName) + " in visibleFields. Setting Visible..."
field_info.setvisible(index, "VISIBLE")
else:
print "Field " + str(fieldName) + " not found in visibleFields. Setting Hidden..."
field_info.setvisible(index, "HIDDEN")