AnsweredAssumed Answered

List mxd-specific layer field alias names.

Question asked by rsm_ddms on Jul 11, 2018
Latest reply on Jul 12, 2018 by rsm_ddms

I have written a simple code to list all fields associated with each feature layer in an mxd. I want to inventory the visible fields and field aliases associated with map services.

The field alias that is being returned is the database alias, not the one set in the mxd. Is there any way to get the layer field alias?

 

for field in field_list:
f_name = field.name
arcpy.AddMessage("> Field Name: "+f_name)
f_index = field_info.findFieldByName(f_name)
f_vis = field_info.getVisible(f_index)
arcpy.AddMessage("> Field Visibility: "+f_vis)

f_alias = field.aliasName
arcpy.AddMessage("> Field Alias: "+f_alias) 
f_type = field.type
arcpy.AddMessage("> Field Type: "+f_type)

 

Thank you,

Randy McGregor

Outcomes