How To: Set up aliases for the field names of ArcSDE layer served by ArcIMS
Instructions provided describe how to set up aliases for the field names of ArcSDE layer served by ArcIMS.
There are two methods that can be implemented to achieve this.
A. Create a field alias list for each layer. For example:
Note: The example above shows a generic example and a sample field alias array for a layer with an id=0. A similar array must be defined for each layer that contains fields to be aliased. B. Parse the response and populate the field names returned from the server C. Loop through and replace the field names for each layer. An example of this functionality can be seen in the 'writeOutDataPage()' function within the aimsIdentify.js file.
Client and Server Side When importing data into SDE an alias can be specified for the field names using the '-a' switch. This reduces the amount of client side programming necessary to parse out the aliased field name. This can be best described in an example which involves importing the 'states' shapefile, from the ESRI Tutorial data, to an SDE featureclass.
A. Create a field alias list, essentially a text file, that lists all of the columns in the shapefile and how they appear in the feature class. For example, this is the contents of the Fields.txt file referenced in Step B, below:
Code: <shape_column> [sde_column] /*do not include this line STATE_NAME NAME STATE_FIPS FIPS SUB_REGION REGION STATE_ABBR ABBREVIATION ... ...
B. Run the shp2sde command to import the shapefile into an SDE feature class. For example:
The new fields now appear with aliased field names such as ARCADMIN.TEST.NAME. C. Since the field names are aliased at the server level, simple string functions ("InStr", "Len", etc) can be employed in the client application to remove "ARCADMIN.TEST" leaving behind "NAME".