5

Is there a way to alter the AliasName on a layer file only, and not the underlying shapefile or feature class? I have a few hundred layers that define joins between hundreds of tables with census data sitting in an MS Access database, and a shapefile with census tracts. I like to keep it this way to not have to store the feature geography for each of those data files.

Each layer file maps out hundreds of variables with intuitive names such as B19325_089. All said, there are several thousand. I would like to change the NameAlias property to have meaningful aliases/variable labels based on a lookup value, but, can it be done/defined in the layer file and not in the actual geography file, as all the layer files create the join to the same shapefile?

I got off to a decent start on feature classes in a file GDB using Mark Cederholm's and Matt Wilkie's suggestions, but am, as noted, curious about whether it is possible to have the alias definition reside in the layer files.

Initially, I thought it very simple and doable with the geoprocessor object as ESRI lists the AliasName property as read/write, but that appears to not be possible, and arcobjects to be necessary.

1 Answer 1

6

It should be possible to cast your featurelayer to ITableFields, then loop through each ITableField.FieldInfo and set IFieldInfo.Alias. Last time I checked no error was raised when I assigned more than one field the same alias, so be careful.

Update: Field aliases can be confusing. There's an alias for fields that are stored in the database (IField.AliasName) which can be changed as shown in this thread. The IFieldInfo.Aliases are what you change when you go into the Fields tab on the Layer Properties dialog in ArcMap. I think those get initialized to whatever the IField.Alias is.

1
  • I will try this tomorrow, even though arcobjects is pretty new to me. Any clue why one can't just use the geoprocessor object, as esri's site suggests is possible with read/write permissions to the AliasName property? webhelp.esri.com/arcgisdesktop/9.3/…
    – ako
    Commented Jan 13, 2011 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.