Select to view content in your preferred language

Modify/Import Aliases in a batch process...

2019
4
01-31-2013 03:04 PM
Status: Closed
Labels (1)
DanielO_Donnell1
Occasional Contributor
I have hundreds of feature classes each bearing tens-to-hundreds of attribute fields... I critically need the ability to modify &/or import the field aliases for all of them in a batch process.

The aliases could be imported from a stand-alone table containing ROW1=Field Name & ROW2 = Field Alias.

Ideally, it would function as "seamlessly" as a table join &/or domain/subtype import.

Thanks!
4 Comments
JasonBalmut
You could use this tool: Rename Field Geoprocessing Tool (10.1)  It will do aliases as well in batch mode.
MicheleH_DNReply
It would also be good to be able to batch add aliases to feature classes - SDE and file geodatabase.
JessicaJThompson

Yes Please! 

Being able to import fields and domains is great. However, manually adding field aliases, and the choice lists for all of the domains seems like a solvable problem that would save everyone so much time! 

@DanielO_Donnell1 's recommendation is perfect. 

SSWoodward
Status changed to: Closed

Using the Alter Fields (multiple) tool allows users to pass any number of class / field_name / alias combinations programmatically into ArcGIS Pro using a little bit of Python. 

For more information on the Alter Fields (multiple) tool check out the documentation linked below. 

https://pro.arcgis.com/en/pro-app/3.4/tool-reference/data-management/alter-fields.htm

In the example below a stand alone table with columns 'field_name' and 'field_alias' is used to update the alias of each named field in a given class.

import arcpy

target_class = << path to target >>
alias_table = << path to alias table >>

field_updates = []

with arcpy.da.SearchCursor(alias_table, ['field_name', 'field_alias']) as cursor:
    for row in cursor:
        name, alias = row
        field_updates.append([name, "", alias])

arcpy.management.AlterFields(
    target_class,
    field_updates
)