<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Do arcpy support highlight field? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/do-arcpy-support-highlight-field/m-p/1414631#M70444</link>
    <description>&lt;P&gt;In ArcGIS Pro，we can highligh field in fied view。But how wo highlight field by arcpy?&lt;/P&gt;</description>
    <pubDate>Wed, 24 Apr 2024 12:01:21 GMT</pubDate>
    <dc:creator>NexSpace</dc:creator>
    <dc:date>2024-04-24T12:01:21Z</dc:date>
    <item>
      <title>Do arcpy support highlight field?</title>
      <link>https://community.esri.com/t5/python-questions/do-arcpy-support-highlight-field/m-p/1414631#M70444</link>
      <description>&lt;P&gt;In ArcGIS Pro，we can highligh field in fied view。But how wo highlight field by arcpy?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 12:01:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/do-arcpy-support-highlight-field/m-p/1414631#M70444</guid>
      <dc:creator>NexSpace</dc:creator>
      <dc:date>2024-04-24T12:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Do arcpy support highlight field?</title>
      <link>https://community.esri.com/t5/python-questions/do-arcpy-support-highlight-field/m-p/1414801#M70450</link>
      <description>&lt;P&gt;What are you trying to do with the highlighted field? Are you trying to do something with the selected features?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 15:27:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/do-arcpy-support-highlight-field/m-p/1414801#M70450</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2024-04-24T15:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Do arcpy support highlight field?</title>
      <link>https://community.esri.com/t5/python-questions/do-arcpy-support-highlight-field/m-p/1414892#M70453</link>
      <description>&lt;P&gt;This is possible, but only through manipulating the CIM, which is a bit tedious.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm" target="_blank"&gt;Python CIM access—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def highlightField(map, layer_name, highlight_field_name):
    lyr = map.listLayers(layer_name)[0]

    # Get the layer's CIM definition
    cim_lyr = lyr.getDefinition("V3")

    # Ensure the featureTable has fieldDescriptions to modify
    # https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm#GUID-C80C9CF4-67C8-418E-BEB5-386B18EE6097
    if len(cim_lyr.featureTable.fieldDescriptions) == 0:
        # No CIM field descriptions class; create one.
        fDesc = arcpy.cim.CreateCIMObjectFromClassName('CIMFieldDescription', 'V3')
        # Get field info and populate the new field description.
        highlight_field_props = [f for f in arcpy.ListFields(lyr) if f.name == highlight_field_name][0]
        fDesc.alias = highlight_field_props.aliasName
        fDesc.fieldName = highlight_field_props.baseName
        fDesc.highlight = True
        fDesc.visible = True
        fDesc.searchMode = "Exact"
        # Add new field description to the CIM.
        cim_lyr.featureTable.fieldDescriptions.append(fDesc)
    else:
        # Make changes to field description in CIM.
        for f in cim_lyr.featureTable.fieldDescriptions:
            if f.fieldName == highlight_field_name:
                f.highlight = True

    # Push the CIM changes back to the layer object
    lyr.setDefinition(cim_lyr)


aprx = arcpy.mp.ArcGISProject("current")
highlightField(aprx.activeMap, "MY_LAYER_NAME", "MY_FIELD_NAME")&lt;/LI-CODE&gt;&lt;P&gt;In my testing, the&amp;nbsp;fieldDescriptions was indeed empty (as the documentation notes) so I created a&amp;nbsp;CIMFieldDescription only for the field being highlighted. This has the effect of moving the highlighted field to the beginning of the attribute table view. If that is not acceptable, you will have to create a&amp;nbsp;CIMFieldDescription for each field in the order you want.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 17:51:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/do-arcpy-support-highlight-field/m-p/1414892#M70453</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2024-04-24T17:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Do arcpy support highlight field?</title>
      <link>https://community.esri.com/t5/python-questions/do-arcpy-support-highlight-field/m-p/1414896#M70454</link>
      <description>&lt;P&gt;The CIM is a weird and wonderful world. I highly recommend watching the session from the 2024 Esri Developer Summit.&lt;/P&gt;&lt;P&gt;&lt;A href="https://devsummit2024.esri.com/flow/esri/24epcdev/deveventportal/page/detailed-agenda/session/1699162630505001kNYF" target="_self"&gt;ArcPy: Beyond the Basics of arcpy.mp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 17:57:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/do-arcpy-support-highlight-field/m-p/1414896#M70454</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2024-04-24T17:57:36Z</dc:date>
    </item>
  </channel>
</rss>

