Select to view content in your preferred language

Model Builder - Using iterator and Add Join tools to join tables

4698
3
Jump to solution
12-12-2012 03:22 PM
DANIELEVILA_NOVA
Occasional Contributor
Hello all,

I am trying to run a model where I join a couple hundreds (hence, why I'm using the model builder!) of tables to a 'matrix/base' table (I'm using the term matrix/base only to refer to this single table as an independent one), using a common column field. This 'matrix/base' table where all the other tables will be joined to is in a different folder than the other several ones (and those are all in one folder; there are only those tables in this folder).

I am using the 'Iterate Tables' on my model in order to go thru all the tables I want to join to my 'matrix' table. The sketch to my model is attached. It runs fine, but my output table has only the last table joined, not all tables from my folder... while running though it looks like it goes thru all the tables in the folder, but maybe the model is 'writing' over every time it goes to a new table to join?

If I do it manually the tables are all joined without deleting or writing over the previous one, so I was wondering if anyone knows why in the model it doesn't go this way? Any help is much appreciated, since I don't want to spend hours (or even days!) joining all tables one by one

oh, and all tables are in a .dbf format.

Cheers,
Daniele[ATTACH=CONFIG]19896[/ATTACH]
1 Solution

Accepted Solutions
DANIELEVILA_NOVA
Occasional Contributor
Hello,

I tried running the model without selecting anything when prompted (select field window) and the model ran fine, and it added both columns I wanted from each table... problem solved to me 🙂

Cheers

Dani

View solution in original post

0 Kudos
3 Replies
DANIELEVILA_NOVA
Occasional Contributor
So now I started using the 'Join Field' instead of the 'Add field' tool to see how it goes... visually it seems to be the right option for me but then I realized that when I use the tables iterator I'm given the option to select which fields I want to appear on my joined table (On the Join Field Window) -  and apparently, that's my problem:

I want to select two fields from each table I want to join. One field is the one that I have in common with all tables (the 'matrix' one - which all tables will be joined to - and all other tables), and since it's the same field name for all tables, the iterator gets that this field will be added in every loop. However, the second field I want to join is VALUE_x (being x a number used as a code so that I know which table corresponds to). This VALUE_x was created automatically on each table (I did a 'tabulate areas' for my layers on a previous model), and on the Join Field Window when I am prompted to select what fields I want to appear on my joined table, the option given to me to select is VALUE_4 (the exact field the first table on my iterator has). Since no other table will have this field, but rather a VALUE_x (some other number), the model goes to an error message "999999 : Error executing function" and ends.

Is there a way for me to add a field like VALUE_% or something similar? Or a way for my iterator to get that in every loop the number will be different?

Thanks,

Daniele
0 Kudos
ShitijMehta
Esri Regular Contributor
Hello Daniele,

Would it be possible for you to share your data or a sample of your data and the model so far?

It is help see your field names and suggest a correct solution.

Thanks!
0 Kudos
DANIELEVILA_NOVA
Occasional Contributor
Hello,

I tried running the model without selecting anything when prompted (select field window) and the model ran fine, and it added both columns I wanted from each table... problem solved to me 🙂

Cheers

Dani
0 Kudos