Generate an attachment match table

Attachments can be added manually during an editing session to a single feature with one or many files. However, adding attachments to one or more features or rows in bulk using the Add Attachments geoprocessing tool requires the creation of a match table.

A match table is also required to remove one or more attachments for one or more features using the Remove Attachments geoprocessing tool.

Match table

A match table consists of two columns and as many rows for each attachment to be added or removed from an attachment-enabled dataset. When you create a match table using the Generate Attachment Match Table geoprocessing tool, a MatchID column and a Filename column are created. The MatchID column contains object IDs from the input dataset that contain a match from file names in a designated folder location. Values in a selected key column in the attribute table are used to match file names and add them to the Filename field.

Populated match table

The following Generate Attachment Match Table tool parameters influence the match table results:

  • Key Field—The selected field from the input dataset. The values in this field are used to match file names (not including the file extension) from the input folder.
  • Input Data Filter—(Optional) A data filter limits the files considered for matching.
  • Match Pattern—(Optional) The pattern used to match file names (not including the file extension) with values specified in the Key Field parameter. The match pattern type options are the following:
    • Exact—File names that are an exact match to the values in the key field will be matched. This is the default.
    • Prefix—File names that have the key field value at the beginning of the file name will be matched.
    • Suffix—File names that have the key field value at the end of the file name will be matched.
    • Any—File names that have the key field value anywhere in the file name will be matched.
  • Store Relative Path—(Optional) Specifies whether the output match table file name contains full paths or only the file name.

Create a match table using an exact match pattern

To create a match table using the exact match pattern, complete the following steps:

Note:

Match tables can be created in file, mobile, or enterprise geodatabases. You must connect to the enterprise geodatabase as a user with privileges to create data in the database.

  1. Start ArcGIS Pro and open a project.
  2. On the Analysis tab in the Geoprocessing group, click Tools, and search for or browse to the Generate Attachment Match Table tool in the Data Management Tools toolset.
    Geoprocessing pane with search results for Generate Attachment Match Table
  3. Click the Generate Attachment Match Table search result to open the tool.

    The Generate Attachment Match Table tool dialog box appears with default settings.

    Generate Attachment Match Table dialog box

  4. For Input Dataset, use the browse button Browse to select a feature class or table, or click the down arrow to choose a dataset from the active map.
  5. For Input Folder, use the browse button Browse to browse to the folder that contains all the files to be loaded as attachments.
    Windows File Explorer with folder of airport files to add to the match table

    Preparing file names in the folder containing the attachment files may be necessary before creating a match table and loading attachments in ArcGIS Pro. For example, the image above displays a variety of media file formats (JPG, PDF, DOCX) in the Airport_Attachment_Files folder. Each file name in this folder contains the airport code. The airport code in this example will be a key element in matching the correct files with the correct feature or row.

  6. For Output Match Table, provide a name for the new table.
    Output Match Table parameter populated
  7. For Key Field, provide a field from the dataset attribute table.

    The values of this field are used to match values in the file names of the input folder. Matching is based on the Match Pattern parameter setting. For example, you can choose the CODE field to match values in each row in the file names from the Input Folder value.

    Attribute table with highlighted key field
  8. Leave the Input Data Filter parameter blank.

    This parameter is optional and allows you to limit the files considered for matching. For example, if *.jpg is typed in the parameter, the tool only includes matching file names with a .jpg extension to the match table.

    Key Field, Input Data Filter, and Match Pattern parameters

  9. For Match Pattern, keep the default setting of Exact.

    This only matches files with an exact match with the values in the CODE field specified as the key field.

    Other options are Prefix, Suffix, and Any.

  10. Optionally, keep Store Relative Path checked so the table only contains the file names.

    Unchecking this option stores the full path of each file.

  11. Click Run to create the match table.

    Match table showing results with the exact match pattern from the Key Field values

    The new table has four rows that exactly match four file names (not including the file extension) in the input folder.

Create a match table using the any match pattern

Using the default Exact setting for the Match Pattern parameter in the previous workflow is recommended when creating an attachment match table with file names that exactly match the values in the key field.

However, you can also create a match table that matches any file name in the input folder and contains the key field values for all applicable features or rows in the input dataset. To do this, change the Match Pattern parameter value to Any and provide a different name for the match table.

Output Match Table parameter with new name and Match Pattern parameter set to Any

Using the example data in the steps above and changing the Match Pattern parameter value to Any generates a match table with all file names included and matched to their respective features with the correct object ID when you click Run. In this example, a new match table was created with a new name.

Match table with results using Match Pattern set to Any

The new table has rows that matched file names (not including the file extension) with a key value in any part of the files in the input folder.

Create a match table using a prefix match pattern

Using Prefix for the Match Pattern parameter value and the same steps and data above, the tool returns values in the key field that match the value at the beginning of the file name from the input folder.

Output Match Table parameter with the new table name, Input Data Filter parameter populated for .jpg files, and Match Pattern parameter set to Prefix

The image below shows the match table results when you set the tool to match only *.jpg files using the Input Data Filter parameter. Data filters can be applied to all match patterns.

Match table with results using a *.jpg filter and Match Pattern set to Prefix

The new table has rows that matched file names (not including the file extension) with a key value at the beginning of the files in the input folder.

Create a match table using a suffix match pattern

You can modify the steps above by changing the Match Pattern parameter value to Suffix.

Input Data Filter parameter set to *.jpg and *.pdf and Match Pattern set to Suffix

In addition to creating a match table with Match Pattern set to Suffix, this example will only return .jpg and .pdf files in the new match table. The two filters are separated by a comma in the Input Data Filter parameter.

Match table with results using .jpg and .pdf filter and Match Pattern set to Suffix

The new table has rows that matched file names (not including the file extension) with a key value at the end of the files in the input folder.

Using any of the four match tables above with the Add Attachments tool adds the file names to their respective features using the Object ID values in the MatchID field.

Match tables can be manually edited to meet the addition and removal of attachments as needed.

Related topics