6

I'm using ArcMap and I'm trying to write a script that automates a join and then does some reporting.

I'm not very experienced with joins and I'm running into a problem. When I do a join manually (right clicking the shapefile and specifying the join) it does the join seemingly automatically. However, when I try and do a "Join Field" in ModelBuilder it takes a really long time. Minutes.

Is there a different method of automating a join using python or Model Builder that runs faster?

mgri
  • 16,159
  • 6
  • 47
  • 80
jabe
  • 299
  • 2
  • 9

3 Answers3

9

If you look at the tool help you'll note that Join Field permanently adds 1 or more fields to the input table.

The tool you probably want is Add Join, which works more like the interactive join command to create a temporary join.

You'll probably want to use Remove Join when you're done though to clean up after yourself.

blah238
  • 35,793
  • 7
  • 94
  • 195
3

In addition to blah238's answer, you should also use the Add Attribute Index geoprocessing tool to create an index for the join. This tool accomplishes the same thing as this prompt:

enter image description here

This will greatly increase performance. Note that some read-only table file types (e.g. CSV) don't support attribute indices, so you'll have to export them to a .dbf file first.

dmahr
  • 11,833
  • 40
  • 68
  • creating an index for the join field in the join table sounds a good idea, but would it also be advised to create an index on the join field of the target layer? @dmahr – Theo F Nov 14 '17 at 17:16
2

This has been reported to the ArcGIS Ideas forum here: https://geonet.esri.com/ideas/8679

A python script to automate joining the fast way has been provided here: http://www.arcgis.com/home/item.html?id=da1540fb59d84b7cb02627856f65a98d

ryanmonk
  • 121
  • 3
  • should be noted this script only works with GDB inputs – NULL.Dude May 10 '17 at 12:57
  • I struggled with awesome slow JoinField in my script. The link to the python script is worth a lot. Following the instructions there I reduced overall calculation time to 1/7. – EikeMike Jan 10 '18 at 19:38