<?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: bulk setting alias names in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451370#M35384</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To be perfectly honest... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As frequently as we users need to modify aliases in bulk, ESRI should develop either...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) a tool/script in the default/standard toolbox under Data Management/Fields, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) a standard option within the "properties" dialog window for feature classes in ArcCatalog, and/or &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) the option to specify which row in a table contains aliases (i.e. during table_to_featureclass, etc.).**&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...which enables users to modify / import a list of aliases in a batch process. This tool/option could/should function similar to importing of GDB domains &amp;amp; subtypes in ArcCatalog, and/or similar to joining feature classes w/ attribute tables in ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;** For example... if row 1 contains field names by default, then why can't row 2 contain the aliases, and rows 3 thru X contain the field values?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Jan 2013 16:52:09 GMT</pubDate>
    <dc:creator>DanielO_Donnell</dc:creator>
    <dc:date>2013-01-21T16:52:09Z</dc:date>
    <item>
      <title>bulk setting alias names</title>
      <link>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451364#M35378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have some of the new ACS data in a file geodatabase and would like to bulk update the aliases of the fields.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ESRI documentation indicates that the field object has an alias property and is read/write. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I set the alias it appears to work standard output python ide, but the changes are not registered in ArcCatalog.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there some way to commit changes or anything.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Dec 2010 22:36:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451364#M35378</guid>
      <dc:creator>JohnGarvey</dc:creator>
      <dc:date>2010-12-20T22:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: bulk setting alias names</title>
      <link>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451365#M35379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Did you ever figure out how to set field aliases using Python?&amp;nbsp; I'm trying to do the exact same thing with ACS data.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Feb 2011 16:50:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451365#M35379</guid>
      <dc:creator>MatthewStarry</dc:creator>
      <dc:date>2011-02-16T16:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: bulk setting alias names</title>
      <link>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451366#M35380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm having the same issue.&amp;nbsp; field.aliasName = value appears to work in python, but it does not seem to be committed to the geodb afterwards.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Feb 2011 01:39:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451366#M35380</guid>
      <dc:creator>KevinMayall</dc:creator>
      <dc:date>2011-02-27T01:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: bulk setting alias names</title>
      <link>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451367#M35381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm also looking for a way to update the alias of 40 or FCs.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jun 2011 15:38:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451367#M35381</guid>
      <dc:creator>AdamInglis</dc:creator>
      <dc:date>2011-06-06T15:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: bulk setting alias names</title>
      <link>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451368#M35382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;When calling list fields you essentially return a copy of the field in the form of the field object, so when modifying the field alias you are modifying the field object not the actually field in the database or layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There has been a bug logged to update the documentation stating this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NIM068561:&amp;nbsp; Update the documentation for the fieldalias property and any other related properties that are listed as read and write. It should clarify that changing the property updates the field object only, it does not make an edit on the geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One workaround, though probably not ideal, I found was using the 'Field Mapping' option in the Feature Class to Feature Class tool.&amp;nbsp; You can use this to update the field alias, then copy the new feature class replacing the old one.&amp;nbsp; Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;env.overwriteOutput = True

fc = "townships"

arcpy.FeatureClassToFeatureClass_conversion(fc, r"c:\temp\python\test.gdb", "Townships2", "",
&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;&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; "NAME \"Township Name\" true true false 100 Text 0 0,First,#,C:\\temp\\python\\Test.gdb\\townships,NAME,-1,-1")
arcpy.Copy_management("townships2", "townships")

arcpy.Delete_management("townships2")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:08:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451368#M35382</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T20:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: bulk setting alias names</title>
      <link>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451369#M35383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was able to get the following python code to work so the alias names within the feature class are persistent in the geo-database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Outline of process:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;�?�&amp;nbsp; Create an arcpy fields mapping object and add the feature class fields using FieldMappings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;�?�&amp;nbsp; Create a python list which has the field and alias name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;�?�&amp;nbsp; Export the arcpy fields mapping object to a text string using exportToString&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;�?�&amp;nbsp; Loop through the fields and alias names list and use the python string replace function to replace the field name with the alias name within the fields mapping exported string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NOTE: the alias name is the doubled quoted word after the field name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Python scripting:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;v_fieldmappings = arcpy.FieldMappings()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;v_fieldmappings.removeAll()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;v_fieldmappings.addTable(v_input_fc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;v_field_alias_list = [['OBSID', 'Observation ID'], ['SPPCODE', 'Species Code'],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&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; ['COMNAME', 'Common Name'],&amp;nbsp; ['SCINAME', 'Scientific Name'], &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&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; ['FEDSTAT', 'Federal Status Code'], ['FEDERAL_STATUS', 'Federal Status Desc'],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&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; ['STATESTAT', 'State Status Code'], ['STATE_STATUS', 'State Status Desc']]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;v_fieldmappingsstring = str(v_fieldmappings.exportToString())&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for v_field in v_field_alias_list:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&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; v_field_name = str(v_field[0])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&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; v_alias_field = str(v_field[1])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; if v_fieldmappingsstring.find(v_field_name) &amp;gt;= 0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&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; v_fieldmappingsstring = v_fieldmappingsstring.replace('"' + v_field_name + '"', '"' + v_alias_field + '"')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; else:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&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; print "Field name " + v_field_name +"not found. Not setting alias name."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;v_fieldmappings.loadFromString(v_fieldmappingsstring)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then the v_fieldmappings can be used in a feature class to feature class process.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jan 2013 20:30:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451369#M35383</guid>
      <dc:creator>KevinKozak</dc:creator>
      <dc:date>2013-01-18T20:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: bulk setting alias names</title>
      <link>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451370#M35384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To be perfectly honest... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As frequently as we users need to modify aliases in bulk, ESRI should develop either...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) a tool/script in the default/standard toolbox under Data Management/Fields, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) a standard option within the "properties" dialog window for feature classes in ArcCatalog, and/or &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) the option to specify which row in a table contains aliases (i.e. during table_to_featureclass, etc.).**&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...which enables users to modify / import a list of aliases in a batch process. This tool/option could/should function similar to importing of GDB domains &amp;amp; subtypes in ArcCatalog, and/or similar to joining feature classes w/ attribute tables in ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;** For example... if row 1 contains field names by default, then why can't row 2 contain the aliases, and rows 3 thru X contain the field values?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 16:52:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bulk-setting-alias-names/m-p/451370#M35384</guid>
      <dc:creator>DanielO_Donnell</dc:creator>
      <dc:date>2013-01-21T16:52:09Z</dc:date>
    </item>
  </channel>
</rss>

