Select to view content in your preferred language

how to show AliasNames of shapefile fields with vb.net?

2542
5
03-27-2012 05:32 AM
SeldaSamiri
Emerging Contributor
Hi everybody,

do you now a possibility to show the AliasNames of a shapefiel with vb.net?
The IFields Interface does not provide this functionality as the help says:
IField.AliasName Property: "This is only supported on fields from object classes and feature classes that are registered with the geodatabase; Personal, File or ArcSDE geodatabases.  For fields coming from other data sources (shapefiles, coverages, etc) the AliasName will be the same string as the field name."

Any other idea?

Thanks for any help
Selda
0 Kudos
5 Replies
GeorgeFaraj
Frequent Contributor
Hi everybody,

do you now a possibility to show the AliasNames of a shapefiel with vb.net?
The IFields Interface does not provide this functionality as the help says:
IField.AliasName Property: "This is only supported on fields from object classes and feature classes that are registered with the geodatabase; Personal, File or ArcSDE geodatabases.  For fields coming from other data sources (shapefiles, coverages, etc) the AliasName will be the same string as the field name."

Any other idea?

Thanks for any help
Selda


You can't show what isn't there. In other words, there is no builtin facility for giving fields an alias. If your data source does not support it directly then you have to do it.  You can implement aliases yourself by saving them in a database table, a file, or as an ArcGIS extension. (I considered developing an extension myself but the down side of that is that the user of your map must have the extension. It seemed much simpler just to store the settings in a file and read them whenever the user needed to select a field.)
0 Kudos
SeldaSamiri
Emerging Contributor
You can't show what isn't there. In other words, there is no builtin facility for giving fields an alias. If your data source does not support it directly then you have to do it.  You can implement aliases yourself by saving them in a database table, a file, or as an ArcGIS extension. (I considered developing an extension myself but the down side of that is that the user of your map must have the extension. It seemed much simpler just to store the settings in a file and read them whenever the user needed to select a field.)


Hi! Thanks for the fast answer. What I don't understand: When I open the attribute table of a shape file and then open the properties of a field I have a line for "Alias" and I can change ist (and it is saved - so when I open the shape file again, the changed alias is still there and is different from the "name" of the field).
So it _is_ there, but you mean there's really no possibility to read it out?

Greetings
Selda
0 Kudos
NeilClemmons
Honored Contributor
As already mentioned, a shapefile is not capable of storing field aliases.  What you're seeing are the field aliases stored in the mxd.  You can set a field alias on any attribute field through the Fields property page but this alias is only stored in the document.  If you add that shapefileto another mxd, then it will not have those aliases.  You can access these field aliases through IFieldInfo.  To do this, get the feature layer from the map, QI over to ILayerFields and call ILayerFields.FieldInfo().
0 Kudos
SeldaSamiri
Emerging Contributor
Now I see, thanks a lot!!!

Greetings
Selda
0 Kudos
DuncanHornby
MVP Notable Contributor
Another way of keeping any Alias names for a shapefile is saving a LayerFile for it. This will allow you to load shapefiles and keep the alias as long as you load the Layer file and not the source shapefile which does not store that information....Just an idea...

Duncan
0 Kudos