1

I have two shape files and want to join these two attribute table with common field. But arcpy throws the following error.

arcpy.management.AddJoin(output_feature, "AccountPoi", lstfc1[x1-1], "AccountID", "KEEP_COMMON")
Traceback (most recent call last):
 File "C:/Users/dxc163530/PycharmProjects/start_charm.py", line 48, in <module>
 arcpy.management.AddJoin(output_feature, "AccountPoi", lstfc1[x1-1], "AccountID", "KEEP_COMMON")
 File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5096, in AddJoin
 raise e
 File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5093, in AddJoin
 retval = convertArcObjectToPythonObject(gp.AddJoin_management(*gp_fixargs((in_layer_or_view, in_field, join_table, join_field, join_type), True)))
 File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 506, in <lambda>
 return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.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 Mosaic Layer.
WARNING 000970: The join field AccountPoi in the join table AccountPoints is not indexed. To improve performance, we recommend that an index be created for the join field in the join table.
Failed to execute (AddJoin).
Process finished with exit code 1
PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Dec 3, 2016 at 23:45
1
  • More clearly you need to understand the difference between a feature class, a shapefile is an instance of it and feature layer. Commented Dec 4, 2016 at 3:11

1 Answer 1

4

The error message tells you what the problem is:

The value cannot be a feature class

Add Join gives temporary results, so the inputs need to be layers, such as those from Make Feature Layer.

If you want the join to be permanent, take a look at the similar tool, Join Field. It creates a permanent join (ie it adds fields to the table), though the parameters are slightly different.

answered Dec 4, 2016 at 1:23
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.