IsVisible property of CIMTableFrameField will only set to True

152
0
02-15-2024 09:42 AM
PhilLarkin1
Occasional Contributor III

When setting the isvisible property a table frame field using CIM, ArcPro will not honor False, only True. The Table Frame is referenced in the layout via a map. The layer in the map is a feature class in a file geodatabase. 

Pro Version: 3.2.0

Code:

aprx = arcpy.mp.ArcGISProject("CURRENT")
mapTable = aprx.listMaps('Tables')[0]
mapTableLayout = aprx.listLayouts('CU Tables')[0]
otherTableElem = mapTableLayout.listElements("MAPSURROUND_ELEMENT", "otherTableFrame")[0]
otherTableCIM  = otherTableElem.getDefinition('V3')

if hasattr(otherTableCIM, "fields"):    
    fieldNames = [elm.name.lower() for elm in otherTableCIM.fields]
    if "acres" in fieldNames:
        for field in otherTableCIM.fields:
            if field.name.lower() == 'acres':
                field.isVisible == True # This will update the visibility. False will not have an effect.
otherTableElem.setDefinition(otherTableCIM)

 

0 Kudos
0 Replies