<?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 Re: Listing Field Aliases with Python and Pro in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/listing-field-aliases-with-python-and-pro/m-p/125534#M798</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I too discovered that, and unfortunately, no the aliases have been stored in this specific Pro project, not with the data source. I have a clever yet cumbersome workaround, but hey, everything I had to do in the original script to turn the fields off was a clever and cumbersome workaround, what's another.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Save the layer file, hack into the JSON and get the field aliases like this: **shhh don't tell esri we are smart enough to do this**&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;aliases &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; open&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyrx_path&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; json_file&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   data &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; json&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;load&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;json_file&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
   field_info &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; data&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'layerDefinitions'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'featureTable'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'fieldDescriptions'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; field_info&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
      aliases&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'alias'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 07:08:53 GMT</pubDate>
    <dc:creator>DylanHarwell</dc:creator>
    <dc:date>2021-12-11T07:08:53Z</dc:date>
    <item>
      <title>Listing Field Aliases with Python and Pro</title>
      <link>https://community.esri.com/t5/developers-questions/listing-field-aliases-with-python-and-pro/m-p/125532#M796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a follow up problem to my previous dilemma:&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/thread/231440-turn-off-fields-with-python"&gt;Turn Off Fields with Python&lt;/A&gt;&amp;nbsp;which is working, however, we keep discovering things that need to be added to preserve all the properties of the original project (TOC order and visibility, group layers, disable popups, etc.). The final thing (we think) that needs to be preserved is field aliases. Now I know there are at least two ways to access this property - arcpy.ListFields() or arcpy.Describe().fields&lt;/P&gt;&lt;P&gt;Neither of which seem to work - they always list the actual field names, not the aliases, even when aliases exist.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been testing this directly in the Python window within Pro. Below is a screenshot of a test layer field table, with the two methods to access field properties below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this another bug in Pro or is there something here that I completely missing..??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/442319_fields.PNG" /&gt;&lt;IMG alt="" class="image-2 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/442320_fields1.PNG" /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;IMG alt="" class="image-3 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/442321_fields2.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Apr 2019 17:12:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/listing-field-aliases-with-python-and-pro/m-p/125532#M796</guid>
      <dc:creator>DylanHarwell</dc:creator>
      <dc:date>2019-04-17T17:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Listing Field Aliases with Python and Pro</title>
      <link>https://community.esri.com/t5/developers-questions/listing-field-aliases-with-python-and-pro/m-p/125533#M797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are the aliases associated with the layer or the data source?&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/help/data/geodatabases/overview/create-modify-and-delete-fields.htm#ESRI_SECTION1_E12FD4B6BEE2491BA1D595CAB808EDA6"&gt;Fields view: Current Layer drop-down menu&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/thread/202949-arcgis-pro-how-to-bulk-change-aliases-in-geodatabase-level"&gt;Edit field aliases on the data source&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just tested this and found that the modified field aliases were only printed if I changed the data source aliases. I think ListFields accesses the selected layer's source dataset, so changes to the layer's aliases aren't reflected in the result returned by the function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Apr 2019 19:32:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/listing-field-aliases-with-python-and-pro/m-p/125533#M797</guid>
      <dc:creator>StephenM</dc:creator>
      <dc:date>2019-04-17T19:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Listing Field Aliases with Python and Pro</title>
      <link>https://community.esri.com/t5/developers-questions/listing-field-aliases-with-python-and-pro/m-p/125534#M798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I too discovered that, and unfortunately, no the aliases have been stored in this specific Pro project, not with the data source. I have a clever yet cumbersome workaround, but hey, everything I had to do in the original script to turn the fields off was a clever and cumbersome workaround, what's another.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Save the layer file, hack into the JSON and get the field aliases like this: **shhh don't tell esri we are smart enough to do this**&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;aliases &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; open&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyrx_path&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; json_file&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   data &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; json&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;load&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;json_file&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
   field_info &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; data&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'layerDefinitions'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'featureTable'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'fieldDescriptions'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; field_info&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
      aliases&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'alias'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:08:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/listing-field-aliases-with-python-and-pro/m-p/125534#M798</guid>
      <dc:creator>DylanHarwell</dc:creator>
      <dc:date>2021-12-11T07:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Listing Field Aliases with Python and Pro</title>
      <link>https://community.esri.com/t5/developers-questions/listing-field-aliases-with-python-and-pro/m-p/1009204#M5711</link>
      <description>&lt;P&gt;I think this the workaround I will have to use to do most of my Geoprocessing. So much of the functionality in Pro is just not available in arcpy but hacking into the LYRX may work and then using it to redefine my layers (numeric formatting etc)&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2020 02:52:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/listing-field-aliases-with-python-and-pro/m-p/1009204#M5711</guid>
      <dc:creator>LeandraGordon</dc:creator>
      <dc:date>2020-12-14T02:52:33Z</dc:date>
    </item>
  </channel>
</rss>

