This document is archived and information here might be outdated.  Recommended version.


IFieldMap Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > ArcObjects namespaces > Editor > ESRI.ArcGIS.Editor > Interfaces > IF > IFieldMap Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Editor)  

IFieldMap Interface

Provides access to members that control the behavior of the field mapping tools.

Product Availability

Available with ArcGIS Desktop.

Members

Name Description
Method DeleteFieldMap Delete an individual field map (source or destination).
Read-only property FieldMap Enum of field maps.
Method GetSourceField The source field for the provided target field.
Method GetTargetField The target field for the provided source field.
Read-only property IsEmpty Indicates if any field mappings have been set.
Method SetFieldMap Establishes a field mapping between the source and target fields.
Read/write property SourceClass Source class (required) for field mapping.
Read/write property TargetClass Target class (required) for field mapping.

CoClasses that implement IFieldMap

CoClasses and Classes Description
FieldMap (esriEditorExt) The Field map object defines how attributes will get transfered.

Remarks

A FieldMap contains a number source and target fields for use in attribute transfer.

To create a new FieldMap, instantiate a new FieldMap object then set its source and target feature class via the SourceClass and TargetClass properties. Next set each source and target pair via the SetFieldMap method.

Source/Target field pairs can be can be queried via the FieldMap property, which returns an IEnumFieldMap object containing the field pairs.

A source/target field pair can be removed from a FieldMap by using the DeleteFieldMap method. Only the source field is specified.

[C#]

private void setUpFieldMap(IFeatureLayer sourceFeatureLayer, IFeatureLayer targetFeatureLayer)
{
    //get editor extension
    UID editorUID=new UIDClass();
    editorUID.Value="esriEditor.Editor";
    IEditor editor=m_application.FindExtensionByCLSID(editorUID) as IEditor;
    IAttributeTransferType attributeTransferType=editor as IAttributeTransferType;
    IAttributeTransfer attributeTransfer=attributeTransferType.AttributeTransfer;

    IFieldMap fieldMap=new FieldMapClass();
    fieldMap.SourceClass=sourceFeatureLayer.FeatureClass;
    fieldMap.TargetClass=targetFeatureLayer.FeatureClass;
   
    int souceFieldID=sourceFeatureLayer.FeatureClass.Fields.FindField("test");
    int tagetFieldID=targetFeatureLayer.FeatureClass.Fields.FindField("test");
    IField sourceField=sourceFeatureLayer.FeatureClass.Fields.get_Field(souceFieldID);
    IField targetField=targetFeatureLayer.FeatureClass.Fields.get_Field(tagetFieldID);
    fieldMap.SetFieldMap(sourceField, targetField);
    attributeTransfer.FieldMap=fieldMap;
}