[GIS] Limitations of iterate row selection in ArcGIS ModelBuilder

arcgis-desktopiterationmodelbuilderrelates

inb4 using real script ;), I'm looking for some advice on arc's model builder.

The iterate row selection in Arc's model builder allows you to make multiple table views based on field groupings of a table. These table views then can be used for other processes in the model.

I'm using the table views to calculate multiple variables which are then populated into a different feature dataset. More or less, I'm using the iterate row selection to run processes on sets of related records (MANY) in one table and then using the results to populate a second table (ONE).

One of the fields in the second table requires a variable that is calculated in part by a group of records that is not the group of records identified by the iterate row selection. In other words, thus far each field only requires the set of records made into a table view by the iterator. But as mentioned above, this new field requires a table view not based on the selections made possible in the iterate row selection–a different relationship is required.

There are some problems with this in model builder. My approach now is to take the inline variable output of the iterate row selection and use it in an sql expression of a seperate Make Table View within the model. This Make Table View is based on the original table (used by the iterator) with the variable in an sql expression such that a different column is used to base the make table view on for each iteration. example: "c%Value%" = 1. (in the table there are a number of column headers that begin with the letter c and then a number. |c1|c2|c3|c4|…c24|. My reasoning is, with each iteration, a new %Value% is produced (1-24), and with each new %Value% the separate Make Table View "should" produce a table view based on the inline variable in the expression, which then can used to make the necessary calculations which then can be calculated into the second table's problematic field.

After running the model, I find that the fields thus far calculate correctly, but the problematic field has values that are quite wrong. Running the make table view independently produces the correct variables as well calculating those values into the target dataset, but when ran with the iterator, it does not work.

Best Answer

I would add a precondition going

From:

The "Value" coming out of the iterator

To:

"Make Table" (the 1st tool you run on "Final1(2)")

This will make sure the value changes each time

Related Question