Field alias and shapefiles

5383
6
01-03-2019 02:36 PM
HannahHutchins1
New Contributor II

I have created a shapefile and joined an Excel table to this shapefile to populate the attribute table. This shapefile is for someone else in our department (end user) and so I wanted to add Field Aliases to help them understand the field names. When I export the shapefile with the joined Excel table, the newly created shapefile does not retain the Field Aliases I set. This is an issue for the end user of this data may be exporting data from this shapefile in the future, thus losing those Field Aliases...

Why is this happening?

I understand that working in a file geodatabase may resolve the issue, but the end user of this data prefers shapefiles.

Any thoughts of suggestions would be greatly appreciated!

6 Replies
AdrianWelsh
MVP Honored Contributor

Hannah,

Are you using ArcMap or Pro?

I have a feeling if just using a geodatabase would help and then export it back out to a shapefile.

In any case, take a look at this article:

Essentials of joining tables—Help | ArcGIS Desktop 

The third paragraph says this:

In most cases, appended columns are named <TableName>.<FieldName>. This naming convention helps prevent duplicate field names when the target table and a join table have common field names. If you do not want to see the full field names like that, click the Table window's Table Options button Table Options and click Show Field Aliases to toggle this option on or off. When this option is on, a check mark Show Field Aliases is displayed beside it on the Options menu, and your fields are not prefixed with the table name.

This might help.

0 Kudos
RichardFairhurst
MVP Honored Contributor

Field aliases can only be saved in the data source in a geodatabase and these field aliases can be exported to another geodatabase, but not to a shapefile.  Only geodatabase field aliases will be used when you check the "Use field alias as column header (optional)" button on the Table to Excel tool.

When you set an alias in ArcMap you are setting a Layer field alias that only exists in that map.  These aliases are never used by the Table to Excel tool and cannot be exported by that tool.

The only way to preserve Layer Field Aliases is to select all or part of the records in a table view, press the Move to End of Table button to make sure you will output more than 2048 records, right click on the left-hand grey record selector for one of the records and choose the Copy Selected option.  Then you can open Excel and hit the paste button.  The records with be pasted into Excel and the Layer Field Aliases will be preserved.  I just tested this method with 30,000 records and it worked without a problem.  However, there are memory limits affecting this option, so at some point this option will fail if your data set becomes excessively large.

This is from the "Understanding field properties, aliases and table display properties" help:

"There are two types of field aliases: feature class field aliases (geodatabase only) and layer field aliases. You work with feature class field aliases in ArcCatalog on the Feature Class Properties dialog box. 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."

AdrianWelsh
MVP Honored Contributor

This makes perfect sense! I guess I hadn't worked with shapefiles in a while and forgotten that they do not really have aliases, just at the 'layer' level within a map document. Thanks Richard!

0 Kudos
RichardFairhurst
MVP Honored Contributor

If your real goal is to make sure the aliases are shown with the exported shapefile in a layer, you can save a layer file of the layer you set up with aliases and they will be preserved.  If you provide the layer file together with any exported shapefile to anyone then they can add the layer file to their map instead of the shapefile.  If you use relative paths with standardized naming for your exported shapefiles and output them to the same directory as layer files set up for the standardized names, you can zip that directory and the receiver can add the layer file to their map rather than the shapefile and they shouldn't need to repoint the data source.  At worst, the receiver may have to change the layer file data source to get everything working again.

AdrianWelsh
MVP Honored Contributor

I agree. Another option is a map package

Creating a map package—Help | ArcGIS for Desktop 

0 Kudos
JoeBorgione
MVP Emeritus

Why not just name the fields in such a fashion that the end user understands them; no aliasing needed....

That should just about do it....