<?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: Change fields alias  in layer within mxd? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308950#M24047</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You may want to give arcpy.mapping.UpdateLayer() a try.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/#/UpdateLayer/00s30000003p000000/"&gt;http://resources.arcgis.com/en/help/main/10.1/#/UpdateLayer/00s30000003p000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will only work well for you if you have the same layer multiple times in the same MXD or many MXDs.&amp;nbsp; The reason being is that you must first create a layer file with ALL the correct layer properties, including your field aliases.&amp;nbsp; So edit one of them and save it to a layer file. Then you write a script to find all the layers and update them using your authored layer file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because you want to update ALL properties, set symbology_only=False.&amp;nbsp; When set to false, ALL properties, including the data source will get overwritten.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Sep 2012 13:50:01 GMT</pubDate>
    <dc:creator>JeffBarrette</dc:creator>
    <dc:date>2012-09-06T13:50:01Z</dc:date>
    <item>
      <title>Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308947#M24044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It is possible to change fields alias&amp;nbsp; in layer within mxd by arcpy?(Table Options &amp;gt; Appearance)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2012 12:10:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308947#M24044</guid>
      <dc:creator>BartłomiejStaroń</dc:creator>
      <dc:date>2012-09-03T12:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308948#M24045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;It is possible to change fields alias&amp;nbsp; in layer within mxd by arcpy?(Table Options &amp;gt; Appearance)&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you taken a look at this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000071000000"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000071000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Sep 2012 18:46:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308948#M24045</guid>
      <dc:creator>KevinYanuk</dc:creator>
      <dc:date>2012-09-05T18:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308949#M24046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It looks like you can get and set the alias name within the scripting environment but I've been unable to actually make that change show up anywhere else.&amp;nbsp; This statement in the help about field objects leads me to believe that you cannot actually change the alias in the resource on disk:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Updating a field property only updates the field object, no changes are made to the actual field in the table or feature class.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 11:18:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308949#M24046</guid>
      <dc:creator>ChristopherThompson</dc:creator>
      <dc:date>2012-09-06T11:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308950#M24047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You may want to give arcpy.mapping.UpdateLayer() a try.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/#/UpdateLayer/00s30000003p000000/"&gt;http://resources.arcgis.com/en/help/main/10.1/#/UpdateLayer/00s30000003p000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will only work well for you if you have the same layer multiple times in the same MXD or many MXDs.&amp;nbsp; The reason being is that you must first create a layer file with ALL the correct layer properties, including your field aliases.&amp;nbsp; So edit one of them and save it to a layer file. Then you write a script to find all the layers and update them using your authored layer file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because you want to update ALL properties, set symbology_only=False.&amp;nbsp; When set to false, ALL properties, including the data source will get overwritten.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 13:50:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308950#M24047</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2012-09-06T13:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308951#M24048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Updating a field property only updates the field object, no changes are made to the actual field in the table or feature class.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, I've spent too many hours trying to solve this issue.&amp;nbsp; It appears you cannot change the field alias for a field within the mxd file and save it back to the mxd file.&amp;nbsp; The alias name in the mxd file is &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005s0000003n000000"&gt;independent of the data source once set&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;When a geodatabase feature class is added to ArcMap, its field aliases are used initially for the layer field aliases. However, after this there is no link between the two. Properties set in ArcMap will override the properties of the data source, but they will not be carried back to the data source. This means that if you change a layer field alias, it will not change the feature class field alias, and if you change a geodatabase field alias, it will not update the layer field alias for any existing layers based on the feature class.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is completely frustrating that the mxd field alias cannot be changed using python.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 17:39:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308951#M24048</guid>
      <dc:creator>TysonSchoepflin</dc:creator>
      <dc:date>2014-03-10T17:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308952#M24049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you found any other method to update the field alias in an mxd layer ?&lt;/P&gt;&lt;P&gt;Our SDE contains the updated alias but not able to update in mxd.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN&gt;Well, I've spent too many hours trying to solve this issue. &lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;How you solved your issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Dec 2016 10:32:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308952#M24049</guid>
      <dc:creator>Jose_FrancisK_J</dc:creator>
      <dc:date>2016-12-05T10:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308953#M24050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/alter-field-properties.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/alter-field-properties.htm"&gt;Alter Field—Data Management toolbox | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Dec 2016 14:36:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308953#M24050</guid>
      <dc:creator>MitchHolley1</dc:creator>
      <dc:date>2016-12-05T14:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308954#M24051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alter Field tool is to rename fields or field aliases for any feature class. I've already updated alias name in feature class. Since MXD layers have separate field mappings, the alias from the SDE fields are not reflecting in MXD layer. Hence thought of reading the layers from mxd and update the field alias.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As &lt;A _jive_internal="true" data-avatarid="1023" data-externalid="" data-online="false" data-presence="null" data-userid="3200" data-username="jbarrette-esristaff" href="https://community.esri.com/people/jbarrette-esristaff"&gt;Jeff Barrette&lt;/A&gt; said, I've tried the &lt;SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/#/UpdateLayer/00s30000003p000000/"&gt;UpdateLayer &lt;/A&gt;method. This has to be executed with the flag symbology_only=False for updating the fields. When I executed this, I lost the symbology.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Dec 2016 15:07:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308954#M24051</guid>
      <dc:creator>Jose_FrancisK_J</dc:creator>
      <dc:date>2016-12-05T15:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308955#M24052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For what it is worth now, I kind of found a way to indirectly do this. Although it is not directly altering the field alias in the MXD, this way does seem to work. I create a data inventory of my feature classes in the gdb in a csv file. I then update all my aliases and stuff in the csv. I then run my next script that uses the AlterField tool to make the changed in my csv file to my feature classes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All pretty standard and non-mxd(ish) up until now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From here, I made use of &lt;A href="https://gis.stackexchange.com/users/12461/t-wayne-whitley"&gt;T. Wayne Whitley&lt;/A&gt; reply from &lt;A href="https://gis.stackexchange.com/questions/230017/using-fieldinfo-setvisible-in-arcpy"&gt;this thread&lt;/A&gt; which actually goes through to update the field visibility setting for the relevant layers using &lt;STRONG&gt;fieldInfo&lt;/STRONG&gt;. Once the new layer is added/updated, the feature classes field alias seems to be updated also. I then use &lt;STRONG&gt;mxd.saveACopy&lt;/STRONG&gt; to make a new output mxd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Julian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Jul 2017 08:12:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308955#M24052</guid>
      <dc:creator>JulianInskip</dc:creator>
      <dc:date>2017-07-22T08:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308956#M24053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This&amp;nbsp;can be done&amp;nbsp;like this (all arcpy, except step 2):&lt;/P&gt;&lt;P&gt;1) Use arcpy.ListFields() to get field names and field aliases from a feature class, and output to a csv file&lt;/P&gt;&lt;P&gt;2) In the csv file, update the alias column&lt;/P&gt;&lt;P&gt;3) Using arcpy, re-add the feature class to the map document (mxd) - it will have the wrong symbology&lt;/P&gt;&lt;P&gt;4) Use&amp;nbsp;arcpy.ApplySymbologyFromLayer_management() to update the symbology&lt;/P&gt;&lt;P&gt;5) Use arcpy to delete the original layer from the MXD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just be aware that&amp;nbsp;&lt;SPAN&gt;ApplySymbologyFromLayer_management may not bring across all layer properties, e.g. Definition Queries.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Dec 2017 04:08:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308956#M24053</guid>
      <dc:creator>Rhys-Donoghue</dc:creator>
      <dc:date>2017-12-13T04:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308957#M24054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have just written a Python script that does&amp;nbsp;what I mentioned&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;above - it works great.&amp;nbsp; Here are the steps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;1) Use arcpy.ListFields() to get field names and field aliases from a feature class, and output to a csv file&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;2) In the csv file, update the alias column&lt;/P&gt;&lt;P&gt;3) Loop through the layers in the map document using&amp;nbsp;arcpy.mapping.ListLayers()&lt;/P&gt;&lt;P&gt;4) If the layer supports "DATASOURCE", create a feature layer using layer.dataSource as the in_features and layer.definitionQuery as the where_clause&lt;/P&gt;&lt;P&gt;5) Save the feature layer to a layer file&lt;/P&gt;&lt;P&gt;6) Create a new&amp;nbsp;arcpy.mapping.Layer from the layer file&lt;/P&gt;&lt;P&gt;7) Set the min and max scales for the new layer using the original layer, i.e. layer.minScale&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; Set the label classes, similar to the previous step&lt;/P&gt;&lt;P&gt;9) Apply the symbology of the original layer using&amp;nbsp;arcpy.ApplySymbologyFromLayer_management()&lt;/P&gt;&lt;P&gt;10) Add the layer to the mxd using&amp;nbsp;arcpy.mapping.InsertLayer()&lt;/P&gt;&lt;P&gt;11) Remove the original layer using&amp;nbsp;arcpy.mapping.RemoveLayer()&lt;/P&gt;&lt;P&gt;12) Save a copy of the mxd using&amp;nbsp;mxd.saveACopy()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works really well and runs in less than a minute even on large mxds.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Dec 2017 22:47:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308957#M24054</guid>
      <dc:creator>Rhys-Donoghue</dc:creator>
      <dc:date>2017-12-13T22:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308958#M24055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;Rhys Donoghue,&lt;/P&gt;&lt;P&gt;can you post your code as example?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to simply set&amp;nbsp;field.aliasName = row[1].encode('utf8') and export Layerfile but&amp;nbsp; don't works...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Damiano&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Dec 2017 11:52:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308958#M24055</guid>
      <dc:creator>DamianoMontrasio</dc:creator>
      <dc:date>2017-12-28T11:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308959#M24056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Damiano, my code is at work and I am on holiday, so I can't post my code at the moment.&amp;nbsp; However, where are you setting the alias?&amp;nbsp; In general, you should set the alias in the geodatabase, not in the map document (MXD file).&amp;nbsp; If you set the alias in the gdb, you don't need to update your alias each time you add the feature class to a map document.&amp;nbsp; Also, you shouldn't be exporting to a layer file.&amp;nbsp; Instead you should be using&amp;nbsp;arcpy.SaveToLayerFile_management(), then later if you need to, you can use&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;arcpy.ApplySymbologyFromLayer_management() to update a layer with the symbology.&amp;nbsp; Also, note that saving a layer file does not save all of the layer properties - which it should, however, it should save the aliases fine.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;Let me know if you need more details.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Dec 2017 06:39:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308959#M24056</guid>
      <dc:creator>Rhys-Donoghue</dc:creator>
      <dc:date>2017-12-29T06:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308960#M24057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rhys,&lt;/P&gt;&lt;P&gt;Thanks for the response, but I need to renaming ALIAS name in MXD... My Feature Class are in Oracle non ESRI GDB&amp;nbsp;with read Only permission...&lt;/P&gt;&lt;P&gt;It's strange that a simply UI task in ArcMap don't have a corresponding function in arcpy.&lt;/P&gt;&lt;P&gt;Why&amp;nbsp;&lt;SPAN style="color: #4d4d4d; background-color: #ffffff;"&gt;aliasName properties of field is "&lt;SPAN&gt;(Read and Write)"????&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/arcpy/classes/field.htm" title="http://pro.arcgis.com/en/pro-app/arcpy/classes/field.htm"&gt;Field—ArcPy Classes | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #ffffff;"&gt;&lt;SPAN&gt;Now I'm trying with toolbox script and CURRENT mxd... maybe...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #ffffff;"&gt;&lt;SPAN&gt;if I have news, I will update you...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #ffffff;"&gt;&lt;SPAN&gt;Damiano&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Dec 2017 08:05:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308960#M24057</guid>
      <dc:creator>DamianoMontrasio</dc:creator>
      <dc:date>2017-12-29T08:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308961#M24058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Damiano,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the Googling I did earlier, I believe aliasName is readonly, although you may be able to use ArcObjects to change it (I didn't look into this).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just realised I may have copied the script I wrote at work to my USB drive.&amp;nbsp; I will see if I can get it for you.&amp;nbsp; Will reply soon.&amp;nbsp; It may do exactly what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rhys&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Dec 2017 09:28:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308961#M24058</guid>
      <dc:creator>Rhys-Donoghue</dc:creator>
      <dc:date>2017-12-29T09:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308962#M24059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is how to change the alias in the geodatabase (I realise this is not what you want - just adding it here in case someone else wants to use it).&amp;nbsp; Will send through a few scripts soon - sorry I'm not sure how to add the script below other than copying and pasting, which messes up the indenting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy, csv&lt;/P&gt;&lt;P&gt;def main(inputFile,wksp,fc):&lt;BR /&gt; arcpy.env.workspace = wksp&lt;/P&gt;&lt;P&gt;fields = []&lt;BR /&gt; excludedFields = ["objectid","shape","shape_length","shape_area","o_shape","o_shape_length","o_shape_area"]&lt;/P&gt;&lt;P&gt;for field in arcpy.ListFields(fc):&lt;BR /&gt; fields.append(field.name)&lt;/P&gt;&lt;P&gt;with open(inputFile, 'rb') as csvfile:&lt;BR /&gt; csvreader = csv.reader(csvfile)&lt;/P&gt;&lt;P&gt;for row in csvreader:&lt;BR /&gt; if row[0] in fields and row[0].lower() not in excludedFields:&lt;/P&gt;&lt;P&gt;in_table = fc&lt;BR /&gt; field = row[0]&lt;BR /&gt; new_field_name = row[0]&lt;BR /&gt; new_field_alias = row[1]&lt;/P&gt;&lt;P&gt;print field&lt;/P&gt;&lt;P&gt;arcpy.AlterField_management(in_table, field, new_field_name, new_field_alias)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if __name__ == '__main__':&lt;/P&gt;&lt;P&gt;# change the parameters below&lt;BR /&gt; inputFile = # input CSV file&lt;BR /&gt; wksp = # input workspace&lt;BR /&gt; fc = # input feature class&lt;BR /&gt; main(inputFile,wksp,fc)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Dec 2017 09:35:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308962#M24059</guid>
      <dc:creator>Rhys-Donoghue</dc:creator>
      <dc:date>2017-12-29T09:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308963#M24060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Damiano,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the code below that should work for you.&amp;nbsp; I can see couple of things in there that need tidying up, e.g. the error trapping, and changing the hardcoded file names to parameters.&amp;nbsp; This script below does what I mentioned in my twelve steps above.&amp;nbsp; The only issue I had was I couldn't copy the advanced label expressions and I couldn't tick the advanced label expression box (but this can be done via ArcObjects, if you don't want to do it manually).&amp;nbsp; The script basically rebuilds your MXD with the new layer aliases that were updated in the geodatabase using the previous script I sent through above.&amp;nbsp; This is not quite what you are after since you can't change the aliases in the GDB, however, hopefully this is enough to put you on the right track.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I understand what you want to do, I would probably create a feature layer with field aliases, and use the code below.&amp;nbsp; If you're really stuck, what you could do is use ArcPy to recreate your feature classes in a file geodatabase but without the data, e.g. use the Make Feature Layer tool and use '1=2' for the where clause, then use the Copy Features tool to create the FCs from the feature layers.&amp;nbsp; Then use the Alter Field tool to create the Aliases in the FGDB,&amp;nbsp;and use the script below to update the MXD.&amp;nbsp; Then once you've done that, close your MXD, rename your FGDB, open your MXD and repair the datasources to point to Oracle.&amp;nbsp; This sounds complicated but is quite easy - unless you're working with complex data sets, e.g. geometric networks, topology, etc. however, since you're using native Oracle, not SDE, I doubt this would be an issue for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Rhys&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have added the code here, which should have the correct indenting: &lt;A class="link-titled" href="https://trinket.io/python/21f87c17cb" title="https://trinket.io/python/21f87c17cb"&gt;Your Python Trinket&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import os, time, arcpy, csv&lt;BR /&gt;from datetime import datetime&lt;/P&gt;&lt;P&gt;def main(layers,visibleFields,directory,results_folder,layer_files_folder):&lt;/P&gt;&lt;P&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;&lt;P&gt;for folder, dirs, files in os.walk(directory):&lt;BR /&gt; for file in files:&lt;BR /&gt; if file.endswith('test.mxd'): # add your MXD name here&lt;BR /&gt; try:&lt;BR /&gt; path = os.path.join(folder, file)&lt;/P&gt;&lt;P&gt;mxd = arcpy.mapping.MapDocument(path)&lt;BR /&gt; data_frame = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]&lt;/P&gt;&lt;P&gt;i = 0&lt;/P&gt;&lt;P&gt;for lyr in arcpy.mapping.ListLayers(mxd, "", data_frame):&lt;/P&gt;&lt;P&gt;# todo - add properties from group layers&lt;BR /&gt; if lyr.supports("DATASOURCE"):&lt;/P&gt;&lt;P&gt;field_info = ''&lt;/P&gt;&lt;P&gt;if lyr in layers:&lt;BR /&gt; desc = arcpy.Describe(lyr)&lt;BR /&gt; field_info = desc.fieldInfo&lt;/P&gt;&lt;P&gt;for i in range(0, field_info.count):&lt;BR /&gt; if field_info.getFieldName(i) not in visibleFields:&lt;BR /&gt; field_info.setVisible(i, "HIDDEN")&lt;/P&gt;&lt;P&gt;# make a feature layer&lt;BR /&gt; in_features=lyr.dataSource&lt;BR /&gt; out_layer=lyr.name&lt;BR /&gt; where_clause=lyr.definitionQuery if lyr.supports("definitionQuery") else ''&lt;BR /&gt; layer = arcpy.MakeFeatureLayer_management(in_features,out_layer,where_clause,"",field_info)&lt;/P&gt;&lt;P&gt;# save the feature layer to a layer file&lt;BR /&gt; in_layer = layer&lt;BR /&gt; out_layer = os.path.join(layer_files_folder, str(i) + '.lyr')&lt;BR /&gt; arcpy.SaveToLayerFile_management(in_layer, out_layer)&lt;/P&gt;&lt;P&gt;# create a new layer&lt;BR /&gt; reference_layer = lyr&lt;BR /&gt; insert_layer = arcpy.mapping.Layer(out_layer)&lt;BR /&gt; insert_position = "AFTER"&lt;/P&gt;&lt;P&gt;# set the min and max scales for the layer&lt;BR /&gt; insert_layer.minScale = lyr.minScale&lt;BR /&gt; insert_layer.maxScale = lyr.maxScale&lt;/P&gt;&lt;P&gt;# copy the label classes from the original layer to the new layer&lt;BR /&gt; if lyr.supports("LABELCLASSES"):&lt;BR /&gt; className = ''&lt;BR /&gt; expression = ''&lt;BR /&gt; SQLQuery = ''&lt;/P&gt;&lt;P&gt;for lblClass in lyr.labelClasses:&lt;BR /&gt; className = lblClass.className&lt;BR /&gt; expression = lblClass.expression&lt;BR /&gt; SQLQuery = lblClass.SQLQuery&lt;BR /&gt; if expression[:3] == 'def':&lt;BR /&gt; print 'Warning: layer "%s" users an Advanced Label Expression' % (lyr.name)&lt;/P&gt;&lt;P&gt;for lblClass in insert_layer.labelClasses:&lt;BR /&gt; lblClass.className = className&lt;BR /&gt; lblClass.expression = expression&lt;BR /&gt; lblClass.SQLQuery = SQLQuery&lt;/P&gt;&lt;P&gt;# show the labels&lt;BR /&gt; if lyr.supports("SHOWLABELS") and expression[:3] != 'def':&lt;BR /&gt; insert_layer.showLabels = lyr.showLabels&lt;/P&gt;&lt;P&gt;# apply the symbology of the original layer to the new layer&lt;BR /&gt; in_layer=insert_layer&lt;BR /&gt; in_symbology_layer = lyr&lt;BR /&gt; arcpy.ApplySymbologyFromLayer_management(in_layer, in_symbology_layer)&lt;/P&gt;&lt;P&gt;# add the layer to the map document&lt;BR /&gt; arcpy.mapping.InsertLayer(data_frame, reference_layer, insert_layer, insert_position)&lt;/P&gt;&lt;P&gt;# remove the original layer&lt;BR /&gt; arcpy.mapping.RemoveLayer(data_frame, lyr)&lt;BR /&gt; i += 1&lt;/P&gt;&lt;P&gt;mxd.saveACopy(os.path.join(directory, 'output.mxd'))&lt;/P&gt;&lt;P&gt;del mxd&lt;/P&gt;&lt;P&gt;except OSError:&lt;BR /&gt; print 'Error with ' + file&lt;/P&gt;&lt;P&gt;if __name__ == '__main__':&lt;BR /&gt; layers = [&lt;SPAN&gt;'','',''] # add your layer names here&lt;/SPAN&gt;&lt;BR /&gt; visibleFields = ['','',''] # add your field names here&lt;BR /&gt; directory = r'C:\dev\map documents (mxds)'&lt;BR /&gt; results_folder = r'C:\dev\scripts\Python\output'&lt;BR /&gt; layer_files_folder = r'C:\dev\gisdata\layer files\temp'&lt;/P&gt;&lt;P&gt;main(layers,visibleFields,directory,results_folder,layer_files_folder)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Dec 2017 10:05:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308963#M24060</guid>
      <dc:creator>Rhys-Donoghue</dc:creator>
      <dc:date>2017-12-29T10:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308964#M24061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot Rhys,&lt;/P&gt;&lt;P&gt;you suggested an interesting idea with a local FGDB&amp;nbsp;as support only for the data structure ...&lt;BR /&gt;I'll do some tests and then update the whole community ...&lt;BR /&gt;I hope I have not ruined your holidays ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Dec 2017 17:00:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308964#M24061</guid>
      <dc:creator>DamianoMontrasio</dc:creator>
      <dc:date>2017-12-29T17:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308965#M24062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds good Damiano, I'm keen to know how you get on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Dec 2017 00:28:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308965#M24062</guid>
      <dc:creator>Rhys-Donoghue</dc:creator>
      <dc:date>2017-12-30T00:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Change fields alias  in layer within mxd?</title>
      <link>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308966#M24063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rhys,&lt;/P&gt;&lt;P&gt;I came back today after a week of vacation, I can tell you that your suggestion has worked.&lt;BR /&gt;Adding the FCs from GDB I see the correct aliases (set by the code), I only need to change the source and point to the SDE.&lt;/P&gt;&lt;P&gt;I will do it these days but I do not think I find particular difficulties ..&lt;/P&gt;&lt;P&gt;thank you again!&lt;/P&gt;&lt;P&gt;Damiano&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jan 2018 10:08:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-fields-alias-nbsp-in-layer-within-mxd/m-p/308966#M24063</guid>
      <dc:creator>DamianoMontrasio</dc:creator>
      <dc:date>2018-01-08T10:08:41Z</dc:date>
    </item>
  </channel>
</rss>

