ModelBuilder Iterator overwriting results

2094
3
Jump to solution
09-15-2011 07:48 AM
BrandonLand
New Contributor III
Hey guys, I think this is a simple question but not sure... I have a map with say, a counties layer and I want to make a tool that will count all the houses in each county (or selected counties) and output the results to a table.   So I have the tool, I put down an interator, passing in the selected counties to a clip function, that then passes the resulting houses into a stat box that counts them.   Problem is, I only get back the last selected county because the stat output overwrites the table with the last result.   How do I make it append or insert the results so I get them all back instead of just one?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor
You need to give the output tables a unique name using a model variable, ie:

out_table%n%.dbf

When you're done you can run the Merge tool to put them together. If you want to automate this process, you need to nest models and in the "outside" model, use the Collect tool to pipe that in to the Merge tool.

Hope this makes some sense. At least it's better than trying to iterate in 9.3!

View solution in original post

0 Kudos
3 Replies
curtvprice
MVP Esteemed Contributor
You need to give the output tables a unique name using a model variable, ie:

out_table%n%.dbf

When you're done you can run the Merge tool to put them together. If you want to automate this process, you need to nest models and in the "outside" model, use the Collect tool to pipe that in to the Merge tool.

Hope this makes some sense. At least it's better than trying to iterate in 9.3!
0 Kudos
BrandonLand
New Contributor III
DUDE that worked, but here's a couple of notes for anyone else that runs into this.   The "Collector tool" goes on the "inside" model that contains the iterator, BUT the Output of the Collector is flaged as a parameter for the "outer model".   ALSO, I banged my head against a wall for 30 minutes because modelbuilder flagged the input tables into the collector as intermediate, and thus was deleting them right before the merge tool fired off!!   Uncheck that box for this exercise.   🙂

Thank you so much!
curtvprice
MVP Esteemed Contributor

You're welcome. For the good of the thread, here is the help section on all that. Sorry, should have posted this before:

Integrating a model within a model—Help | ArcGIS for Desktop 

0 Kudos