Join Field doesn't work on multiple fields

576
3
09-25-2018 05:59 AM
TheodoreF
Occasional Contributor II

I have a Table stored in a Geodatabase. It has 11 or so fields (text, long) containing address information. It has an ID column too.

I also have a polygon shapefile of the property boundaries for these addresses. The shapefile only has an ID column.

I use Join Field to join the Table to the shapefile using the matching ID columns as the join field.

However, joining all the fields from the Table in one go results in error '000852 cannot add field'.

arcpy.management.JoinField(r"D:\Dropbox\Internal Software\Report_WKTs\Ground_WKTs\recover\GroundWKTsites.shp", "Id", r"D:\Tasks_D\GroundRviewer\Ground_R\GR_temp_dump.gdb\Ground_WKT_to_GIS_table", "Join_id", "Address;Client_ref;ClientName;Date;Dev_risk;Ong_risk;Our_ref;Page_order;Postcode;RES_or_COM;Scale")

But... if I join the 11 fields in 11 seperate Join Field runs, it does work:

import arcpy, time
arcpy.management.JoinField(r"D:\Dropbox\Internal Software\Report_WKTs\Ground_WKTs\recover\GroundWKTsites.shp", "Id", r"D:\Tasks_D\GroundRViewer\Ground_R\GR_temp_dump.gdb\Ground_WKT_to_GIS_table", "Join_id", "Address")
time.sleep(1)
arcpy.management.JoinField(r"D:\Dropbox\Internal Software\Report_WKTs\Ground_WKTs\recover\GroundWKTsites.shp", "Id", r"D:\Tasks_D\GroundRViewer\Ground_R\GR_temp_dump.gdb\Ground_WKT_to_GIS_table", "Join_id", "Postcode")
time.sleep(1)
arcpy.management.JoinField(r"D:\Dropbox\Internal Software\Report_WKTs\Ground_WKTs\recover\GroundWKTsites.shp", "Id", r"D:\Tasks_D\GroundRViewer\Ground_R\GR_temp_dump.gdb\Ground_WKT_to_GIS_table", "Join_id", "Date")
time.sleep(1)
arcpy.management.JoinField(r"D:\Dropbox\Internal Software\Report_WKTs\Ground_WKTs\recover\GroundWKTsites.shp", "Id", r"D:\Tasks_D\GroundRViewer\Ground_R\GR_temp_dump.gdb\Ground_WKT_to_GIS_table", "Join_id", "Our_ref")
time.sleep(1)
arcpy.management.JoinField(r"D:\Dropbox\Internal Software\Report_WKTs\Ground_WKTs\recover\GroundWKTsites.shp", "Id", r"D:\Tasks_D\GroundRViewer\Ground_R\GR_temp_dump.gdb\Ground_WKT_to_GIS_table", "Join_id", "Client_ref")
time.sleep(1)
arcpy.management.JoinField(r"D:\Dropbox\Internal Software\Report_WKTs\Ground_WKTs\recover\GroundWKTsites.shp", "Id", r"D:\Tasks_D\GroundRViewer\Ground_R\GR_temp_dump.gdb\Ground_WKT_to_GIS_table", "Join_id", "ClientName")
time.sleep(1)
arcpy.management.JoinField(r"D:\Dropbox\Internal Software\Report_WKTs\Ground_WKTs\recover\GroundWKTsites.shp", "Id", r"D:\Tasks_D\GroundRViewer\Ground_R\GR_temp_dump.gdb\Ground_WKT_to_GIS_table", "Join_id", "Ong_risk")
time.sleep(1)
arcpy.management.JoinField(r"D:\Dropbox\Internal Software\Report_WKTs\Ground_WKTs\recover\GroundWKTsites.shp", "Id", r"D:\Tasks_D\GroundRViewer\Ground_R\GR_temp_dump.gdb\Ground_WKT_to_GIS_table", "Join_id", "Dev_risk")
time.sleep(1)
arcpy.management.JoinField(r"D:\Dropbox\Internal Software\Report_WKTs\Ground_WKTs\recover\GroundWKTsites.shp", "Id", r"D:\Tasks_D\GroundRViewer\Ground_R\GR_temp_dump.gdb\Ground_WKT_to_GIS_table", "Join_id", "RES_or_COM")
time.sleep(1)
arcpy.management.JoinField(r"D:\Dropbox\Internal Software\Report_WKTs\Ground_WKTs\recover\GroundWKTsites.shp", "Id", r"D:\Tasks_D\GroundRViewer\Ground_R\GR_temp_dump.gdb\Ground_WKT_to_GIS_table", "Join_id", "Page_order")
time.sleep(1)
arcpy.management.JoinField(r"D:\Dropbox\Internal Software\Report_WKTs\Ground_WKTs\recover\GroundWKTsites.shp", "Id", r"D:\Tasks_D\GroundRViewer\Ground_R\GR_temp_dump.gdb\Ground_WKT_to_GIS_table", "Join_id", "Scale")
time.sleep(1)
print("Done")

Why???

Tags (1)
Reply
0 Kudos
3 Replies
DanPatterson_Retired
MVP Esteemed Contributor

That error shows up for old old versions of ArcMap (10.1 and 10.2).

One of the reasons cited is that the table is in use by another application. but it has little to do directly with the join. perhaps doing it one at a time with the 'sleep' is enough to release any temporary locks on the file(s).

You could try to see what happens if you remove the sleep lines… I suspect it would fail as well

This can happen when a file is in use by another program, the file is read-only, or the disk is full.

Reply
0 Kudos
TheodoreF
Occasional Contributor II

Hi Dan, thanks.

I'm only using ArcGIS Pro. And writing the code in IDLE, so no ArcMap in operation...

I've seen it mentioned elsewhere about the layer being in use, however, it would error out whether Pro was open or not... hmmm.

And yes, the sleep was put in as a safety measure.

It's all very odd!

Reply
0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Join Field—Data Management toolbox | ArcGIS Desktop 

shows the extra fields in a list, not as a semicolon delimited string

Reply
0 Kudos