<?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 Change display field expression using ArcPy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028008#M60073</link>
    <description>&lt;P&gt;How do I change the display field expression using ArcPy?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CarstenAndersson_0-1613649249261.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6309i43E5A7EEF27A75F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CarstenAndersson_0-1613649249261.png" alt="CarstenAndersson_0-1613649249261.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Feb 2021 11:55:21 GMT</pubDate>
    <dc:creator>CarstenAndersson</dc:creator>
    <dc:date>2021-02-18T11:55:21Z</dc:date>
    <item>
      <title>Change display field expression using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028008#M60073</link>
      <description>&lt;P&gt;How do I change the display field expression using ArcPy?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CarstenAndersson_0-1613649249261.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6309i43E5A7EEF27A75F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CarstenAndersson_0-1613649249261.png" alt="CarstenAndersson_0-1613649249261.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 11:55:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028008#M60073</guid>
      <dc:creator>CarstenAndersson</dc:creator>
      <dc:date>2021-02-18T11:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Change display field expression using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028018#M60074</link>
      <description>&lt;P&gt;It isn't supported in arcpy.&lt;/P&gt;&lt;P&gt;There are old threads to this effect&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/data-management-questions/how-does-arcmap-decide-which-field-is-used-for-the-display/m-p/402938" target="_blank"&gt;How does ArcMap decide which field is used for the... - GeoNet, The Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It isn't under arcpy's layer properties or the recent addition of CIM&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;P&gt;I couldn't even find it as an Idea&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 12:57:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028018#M60074</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-02-18T12:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change display field expression using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028030#M60075</link>
      <description>&lt;P&gt;Hi Dan.&lt;/P&gt;&lt;P&gt;Yeah, I also tried using CIM by setting the displayField property to the required expression. It actually sets it, but it looks strange and doesn't work.&lt;/P&gt;&lt;P&gt;I used this Py code:&lt;/P&gt;&lt;P&gt;lyr_def = lyr.getDefinition("V2")&lt;BR /&gt;lyr_def.featureTable.displayField = "\"Matr. nr. \"+$feature.MatrikelNr+\" \"+$feature.LandsEjerlav+\" (\"+$feature.LandsEjerlavKode+\")\""&lt;/P&gt;&lt;P&gt;Which changes it&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CarstenAndersson_0-1613655057032.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6310i22826AA90148079D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CarstenAndersson_0-1613655057032.png" alt="CarstenAndersson_0-1613655057032.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But for some reason it's adding a $feature. in front of my express. So no luck there. Hopefully this will be added as a possibility in the future.&lt;/P&gt;&lt;P&gt;Thanks for the reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 13:31:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028030#M60075</guid>
      <dc:creator>CarstenAndersson</dc:creator>
      <dc:date>2021-02-18T13:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Change display field expression using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028033#M60076</link>
      <description>&lt;P&gt;$feature .... looks like Arcade to me&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 13:46:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028033#M60076</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-02-18T13:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Change display field expression using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028074#M60077</link>
      <description>&lt;P&gt;displayField and displayExpressionInfo are mutually exclusive, i.e., use displayField for displaying a field only and use displayExpressionInfo for displaying an expression.&amp;nbsp; You are passing an expression into displayField, which is why the "$feature" is being prepended.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:29:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028074#M60077</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-02-18T15:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: Change display field expression using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028478#M60078</link>
      <description>&lt;P&gt;Thanks a lot, Joshua! That actual worked. I ended up with the following code:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;lyr_def = lyr.getDefinition("V2")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;exp_info = arcpy.cim.CIMExpressionInfo()&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;exp_info.expression = "\"Matr. nr. \"+$feature.MatrikelNr+\" \"+$feature.LandsEjerlav+\" (\"+$feature.LandsEjerlavKode+\")\""&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;lyr_def.featureTable.displayExpressionInfo = exp_info&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;lyr.setDefinition(lyr_def)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I really appreciate the help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 14:06:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1028478#M60078</guid>
      <dc:creator>CarstenAndersson</dc:creator>
      <dc:date>2021-02-19T14:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Change display field expression using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1386745#M69959</link>
      <description>&lt;P&gt;Thanks for raising this question, and sharing your solution. I was working with this same issue and this has saved a lot of time.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 14:55:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1386745#M69959</guid>
      <dc:creator>DAVIDWADSWORTH_LVVWD</dc:creator>
      <dc:date>2024-02-26T14:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Change display field expression using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1386755#M69960</link>
      <description>&lt;P&gt;Thanks for contributing to this solution. I had the same question and you have saved me a lot of time.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 15:17:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-display-field-expression-using-arcpy/m-p/1386755#M69960</guid>
      <dc:creator>DAVIDWADSWORTH_LVVWD</dc:creator>
      <dc:date>2024-02-26T15:17:53Z</dc:date>
    </item>
  </channel>
</rss>

