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
-
More clearly you need to understand the difference between a feature class, a shapefile is an instance of it and feature layer.fatih_dur– fatih_dur2016年12月04日 03:11:32 +00:00Commented Dec 4, 2016 at 3:11
1 Answer 1
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.
Explore related questions
See similar questions with these tags.