PROBLEM

Field aliases are wrong when using Dissolve method of IBasicGeoprocessor

Last Published: April 25, 2020

Description

When using the IBasicGeoprocessor Dissolve method and adding the result to the map the field aliases of the dissolve result (as seen in the field headings of the layer's attribute table) are incorrect.

Cause

Aliases are not correctly assigned when adding the dissolve output into ArcMap using VBA. Aliases are assigned correctly when using the Dissolve from the GeoProcessing Wizard. No field aliases will be assigned if you do not add the output to ArcMap programmatically.

Solution or Workaround

The workaround is to set the field aliases to be the same as the field names. To do this, append the following code to your VBA dissolve script. This should go right after you have added the dissolve output (pLayer) to the map (pMxDoc).


Code:

Set pLayer = New FeatureLayer
Set pLayer.FeatureClass = pOutputFC
pLayer.Name = pOutputFC.AliasName
pMxDoc.FocusMap.AddLayer pLayer

Dim pTFlds As ITableFields
Set pTFlds = pLayer
Dim pFldInfo As IFieldInfo
Dim i As Integer

For i = 0 To pTFlds.FieldCount - 1
Set pFldInfo = pTFlds.FieldInfo(i)
pFldInfo.Alias = pTFlds.Field(i).Name
Next i

Article ID:000005339

Software:
  • ArcMap 8 x
  • ArcMap 9 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic