Show Navigation | Hide Navigation
You are here:
Geoprocessing tool reference > Data Management toolbox > Joins toolset > Tools

Add Join (Data Management)

Release 9.2
Last modified November 29, 2010
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Tools"


Related Topics

Joins a table view to a layer (or a table view to a table view) based on a common field.

The records in the input layer or table view are matched to the record in the join table view based on the join field and the Input Field when the values are equal. The join is temporary (as is the layer) and will only last for the duration of the session.


Illustration

Add Join

Usage tips

Command line syntax
An overview of the Command Line window
AddJoin_management <in_layer_or_view> <in_field> <join_table> <join_field> {OUTER | INNER}

Parameter Explanation Data Type
<in_layer_or_view>

The layer or table view to which the join table will be joined.

Table View | Raster Layer
<in_field>

The field in the input layer or table view on which the join will be based.

Field
<join_table>

The table or table view to be joined to the input layer or table view.

Table View | Raster Layer
<join_field>

The field in the join table that contains the values on which the join will be based.

Field
{OUTER | INNER}

Specifies what will be done with records in the input that match a record in the join table.

  • KEEP_ALL — All records in the input layer or table view will be included in the output; also known as an outer join. This is the default.
  • KEEP_COMMON — Only those records in the input that match to a row in the join table will be present in the result; also known as an inner join.

Boolean
Data types for geoprocessing tool parameters


Command line example

MakeFeatureLayer d:\workspace\California.mdb\road road_layer
AddJoin road_layer roadcode d:\workspace\California.mdb\roadLookupTable roadcode
CopyFeatures road_layer road2

Scripting syntax
About getting started with writing geoprocessing scripts
AddJoin_management (in_layer_or_view, in_field, join_table, join_field, join_type)

Parameter Explanation Data Type
in_layer_or_view (Required)

The layer or table view to which the join table will be joined.

Table View | Raster Layer
in_field (Required)

The field in the input layer or table view on which the join will be based.

Field
join_table (Required)

The table or table view to be joined to the input layer or table view.

Table View | Raster Layer
join_field (Required)

The field in the join table that contains the values on which the join will be based.

Field
join_type (Optional)

Specifies what will be done with records in the input that match a record in the join table.

  • KEEP_ALL — All records in the input layer or table view will be included in the output; also known as an outer join. This is the default.
  • KEEP_COMMON — Only those records in the input that match to a row in the join table will be present in the result; also known as an inner join.

Boolean

Data types for geoprocessing tool parameters


Script example

# ExportCADWithJoin.py
# Description: To Export to an AutoCAD file, with each layer created from the Name field in the feature class.
#              AddJoin is used to join the attribute table with the feature class
# Requirements: Python and the Python win32all extension
# Author: ESRI
# Data 1/1/2004

# Create the Geoprocessor object
import arcgisscripting
gp = arcgisscripting.create()

# Local variables...
ImportCAD_mdb = "C:/Test_data/B_0074_ImportCAD.mdb"
Line_fc = "C:/Test_data/B_0074_ImportCAD.mdb/CADStaging/Line"
Entity = "C:/Test_data/B_0074_ImportCAD.mdb/Entity"
property = "C:/Test_data/B_0074_ImportCAD.mdb/property"

try:
    # Process: Select Data...
    gp.SelectData_management(ImportCAD_mdb, "CADStaging/Line")

    # Process: Make Layer...
    gp.MakeLayer_management(Line_fc, "lines_lyr", "", "", "EntID EntID VISIBLE;Shape_Length Shape_Length VISIBLE")

    # Process: Select Data2...
    gp.SelectData_management(ImportCAD_mdb, "Entity")

    # Process: Add Join...
    gp.AddJoin_management("lines_lyr", "EntID", Entity, "EntID", "OUTER", )

    # Process: Select Layer By Attribute...
    gp.SelectLayerByAttribute_management("lines_lyr", "NEW_SELECTION", ""Entity.Layer" = 'B-PROPLINE'")

    # Process: Feature To Polygon...
    gp.FeatureToPolygon_management("lines_lyr", property, "", "ATTRIBUTES", "")

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

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.