How To: Retain all attachments when combining feature classes containing attachments using the Append tool


In some instances, when feature classes containing attachments are merged together, the attachments are dropped and do not get carried over to the new merged feature class. The instructions provided below describe how feature classes with attachments can be merged together using the Append tool while successfully retaining all the attachments in the newly merged feature class.


The instructions below are applicable for ArcGIS for Desktop 10.1 to 10.4. Starting from ArcGIS Desktop 10.5, the Maintain Attachments environment setting is introduced in the Append tool, which allows attachments to be copied when using the tool. For more information, refer to the following document: 10.5 version of the Append tool. 
  1. In ArcCatalog, copy both feature classes into the same geodatabase. Ensure the attachment tables and relationship classes for both feature classes are also copied.

    Image of the Roads and Trails feature classes in the Zion geodatabase
  2. Open ArcMap, and load both feature classes and the attachment tables.
  3. In the attribute table of both feature classes, add a field named GID_SAVE. Set the type as Textwith a length of 100.
  4. Use the Field Calculator to populate the GID_SAVE field from the GlobalID field for both feature classes.
    1. Right-click the desired feature class > Edit Features > Start Editing.

      The image of Start Editing
    2. Right click the GID_SAVE column > Field Calculator.

      Image of the Field Calculator
    3. Select and double-click GlobalID in the Fields section. The expression is specified as 'GID_SAVE = [GlobalID]'.

      The image of the Field Calculator expression.

      The image of the Field Calculator expression.
  5. Select one feature class and the corresponding attachment table of the selected feature class as the target to copy all the features from the other feature class. To do so, follow the steps provided below.
    1. From the Tools toolbar, click the Select Features Image of the Select Features icon icon, select all the features to be copied from the feature class to the target feature class, and click Copy.
    2. Remove the selection by clicking the Clear Selected Features Image of the Clear Selected Features icon icon.
    3. Right-click on the map > Paste.
    4. Select the target feature class in the Paste dialog box, and click OK.

      Image of the Paste dialog box
  6. Click Save Edits, and end the edit session.
  7. Use the Append tool to append the attachment tables together. Use the selected attachment table from Step 5 for the Target Dataset and the other attachment table for the Input Datasets. Set the Schema Type to NO_TEST. Click OK, and let the tool run.

    Image of the Append tool dialog box
    Image of the appended table
  8. When the tables are appended to the selected target attachment table, right-click the table in the Table Of Contents > Joins and Relates > Join. Use the steps provided below to populate the fields in the Join Data dialog.
    1. From the first drop-down list for the Choose the field in this layer that the join will be based on option, select REL_GLOBALID.
    2. From the second drop-down list for the Choose the table to join this layer, or load the table from disk option, select the feature class that the features were copied to in Step 5.
    3. From the third drop-down list for the Choose the field in the table to base the join on option, select GID_SAVE.
    4. Under the Join Options header, select Keep all records, and click OK.

      Image of the Join Data dialog box
      The copied records are now tied back to their original attachments via the original GlobalID field.
  9. Start another edit session, and in the joined attachment table, use the Field Calculator to make the REL_GLOBALID field equal to the GLOBALID field from the joined feature class table for all records, using the following expression: REL_GLOBALID = [GLOBALID].
  10. Save the edits, and end the edit session. All the attachments are now successfully carried over to the joined feature class.
After Step 10, the GID_SAVE field can be removed from the feature classes, if desired, as the field is no longer required.

Related Information