Issue With Export After Join In Model Builder

2019
4
Jump to solution
08-12-2021 11:55 AM
ChristopherDean
New Contributor II

Using ArcGIS Pro 2.7.3 I have a model that takes a feature class, uses add join to join to a table in a file gdb, uses feature class to feature class to export to a new file gdb, then removes the join, and iterates through all tables in the file gdb (there are 80 tables). 
The model runs without error, the first feature class attribute table is complete with all the data, but all subsequent feature classes have the original feature class data, the fields from the table, but all the values in the fields from the table are null. 
Checking by doing some manual joins, the number of features in the output is correct and if I export them manually all the data exports in the fields correctly.
Any ideas what I am missing that is preventing the data from the table to be included with the export from the model?
Thanks,

Chris 

1 Solution

Accepted Solutions
ChristopherDean
New Contributor II

The join is removed at after feature class to feature class before the next iteration starts. I replaced feature class to feature class with copy features and it seems to work. 

View solution in original post

4 Replies
curtvprice
MVP Esteemed Contributor

You should probably remove the join at the end of each iteration.

This is model builder question so I am move it to that forum.

0 Kudos
ChristopherDean
New Contributor II

The join is removed at after feature class to feature class before the next iteration starts. I replaced feature class to feature class with copy features and it seems to work. 

curtvprice
MVP Esteemed Contributor

Your issue is the field map on the second and later iterations does not match the input table. The field map is initialized and populated from the first iteration when the model is validated and is not refreshed on every subsequent iteration.

Using the Copy Features tool is a good workaround, as that tool does not use a field map.

Another solution would to build the field map on each iteration at runtime using Calculate Value with a python code, using arcpy FieldMap properties and methods. This is a lot more complicated and involves good understanding of the FieldMap arcpy object but gives you full control of the schema of the output table.

jhomme981
New Contributor II

Hi Chris!
I almost posted the same concern/issue, but then saw your post.

To preface, I am needing this done in ModelBuilder as well. That said, and similar to your post, I am having to first do a spatial join, then a normal join. The two joins are necessary bc I needed the spatial join to create a Target_ID, which then allows me to do a normal join by matching that Target_ID to match with the original tables Object_ID.) That was just some background, but this is where I'm struggling. So, after the joins, next is when the transfer attributes is attempted (even tried Calculate Field Tool), I only need one field in the attribute table data to transfer over to the original FC attribute table. I was able to get to the point of being able to do this, but the data changes names and (like you) would have to select them individually.  For example, the electrical data i'm using has a ConditionIndex value changes for each electrcial asset (i.e., transformer or primary overhead line, secondary overhead, meters and so on) They all require being ran individually.  Anyway, I was wondering if you figured out what you needed on here or you decided to go a different route for resolution?  Many Thanks for your original post!!

0 Kudos