Append (Data Management)

License Level:BasicStandardAdvanced

Summary

Appends multiple input datasets into an existing target dataset. Input datasets can be point, line, or polygon feature classes, tables, rasters, raster catalogs, annotation feature classes, or dimensions feature classes.

To combine input datasets into a new output dataset, use the Merge tool.

Illustration

Append illustration

Usage

Syntax

Append_management (inputs, target, {schema_type}, {field_mapping}, {subtype})
ParameterExplanationData Type
inputs
[inputs,...]

The input datasets whose data will be appended into the target dataset. Input datasets can be point, line, or polygon feature classes, tables, rasters, raster catalogs, annotation feature classes, or dimensions feature classes. Each input dataset must match the data type of the target dataset.

Table View; Raster Layer
target

The existing dataset that the input datasets' data will be appended into. Each input dataset must match the data type of the target dataset.

Table View; Raster Layer
schema_type
(Optional)

Specifies if the schema (field definitions) of the input datasets must match the schema of the target dataset in order for data to be appended.

  • TESTInput dataset schema (field definitions) must match the schema of the target dataset. An error will be returned if the schemas do not match.
  • NO_TESTInput dataset schema (field definitions) do not have to match that of the target dataset. Any fields from the input datasets that do not match the fields of the target dataset will not be mapped to the target dataset unless the mapping is explicitly set in the Field Map control.
String
field_mapping
(Optional)

Controls how the attribute information in input datasets' fields is transferred to the target dataset. This parameter can only be used if the Schema Type NO_TEST is specified.

Because the input datasets' data is appended into an existing target dataset that has a predefined schema (field definitions), fields cannot be added or removed from the target dataset.

Merge rules allow you to specify how values from two or more input fields are merged or combined into a single output value. There are several merge rules that determine how the output field is populated with values.

  • First—Use the input fields' first value.
  • Last—Use the input fields' last value.
  • Join—Concatenate (join) the input fields' values.
  • Sum—Calculate the total of the input fields' values.
  • Mean—Calculate the mean (average) of the input fields' values.
  • Median—Calculate the median (middle) of the input fields' values.
  • Mode—Use the value with the highest frequency.
  • Min—Use the minimum value of all input fields' values.
  • Max—Use the maximum value of all input fields' values.
  • Standard deviation—Use the standard deviation classification method on all input fields' values.
  • Count—Find the number of records included in the calculation.

Field Mapping
subtype
(Optional)

A subtype description to assign that subtype to all new data that is appended to the target dataset.

String

Code Sample

Append example 1 (Python window)

The following Python window script demonstrates how to use the Append tool in immediate mode.

import arcpy
arcpy.env.workspace = "C:/data/"
arcpy.Append_management(["north.shp", "south.shp", "east.shp", "west.shp"], "wholecity.shp", "TEST","","")
Append example 2 (stand-alone Python script)

The following script demonstrates how to use the Append tool.

# Name: Append.py
# Description: Use the Append tool to combine several shapefiles


# import system modules 
import arcpy, os
from arcpy import env

# Set environment settings
env.workspace = "C:/data"

# Set local variables
outLocation = "C:/Output"
emptyFC = "MA_towns.shp"
schemaType = "NO_TEST"
fieldMappings = ""
subtype = ""

try:
    # Process:  Create a new empty feature class to append shapefiles into
    arcpy.CreateFeatureclass_management(outLocation, emptyFC, "POLYGON", "amherst.shp")

    # All polygon FCs in the workspace are MA town shapefiles, we want to append these to the empty FC
    fcList = arcpy.ListFeatureClasses("","POLYGON")
    # list will resemble ["amherst.shp", "hadley.shp", "pelham.shp", "coldspring.shp"] 

    # Process: Append the feature classes into the empty feature class
    arcpy.Append_management(fcList, outLocation + os.sep + emptyFC, schemaType, fieldMappings, subtype)

except:
    # If an error occurred while running a tool print the messages
    print arcpy.GetMessages()

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015