3

I am trying to join a field of values found within a DBF to a multi-polyline shapefile. They share a common field name (filename) and the values found within each are identical. I was able to run Join Field without a hitch in ArcMap, but I'm receiving two errors when I try to run it in Python with identical parameters. Here's the block of code:

merge_features = r"C:/Users/kellyj/Desktop/Projects/CostAnalysis/merge_features"
import arcpy
from arcpy import env

arcpy.env.workspace = merge_features
arcpy.AddJoin_management("merged_lines.shp", "filename", "merged_table.dbf", "filename")

These are the errors I receive:

ExecuteError: Failed to execute. Parameters are not valid.
The value cannot be a feature class
ERROR 000840: The value is not a Raster Layer.
ERROR 000840: The value is not a Raster Catalog Layer.
ERROR 000840: The value is not a Mosaic Layer.
WARNING 000970: The join field filename in the join table merged_lines is not indexed. To improve performance, we recommend that an index be created for the join field in the join table.

Any thoughts as to what's happening here?

11

The input for AddJoin_management needs to be a feature layer, not a shapefile or feature class.

You can get around this by making a feature layer, and then joining that layer to your table. (You'll still get the "not indexed" warning, but that shouldn't prevent the script from executing.)

arcpy.MakeFeatureLayer_management("merged_lines.shp", "tempLayer")
arcpy.AddJoin_management("tempLayer", "filename", "merged_table.dbf", "filename")
5

You don't specify a version, so I'll just answer based on 10.1 which I 'm using.

First, check the Add Join help file for the function you've used. In particular this part:

The input must be a feature layer, a table view, or a raster layer that has an attribute table; it cannot be a feature class or table.

Then take a look at Join Field.

You appear to be confusing two similar functions.

  • 1
    A very late note. If your dataset is big, be wary of Join Field. – Martan Aug 1 at 2:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.