Iterators for Multiple Inputs in ModelBuilder

1914
3
03-30-2018 03:18 PM
GinnyHarris1
New Contributor

I am attempting to run GeodatabaseSchemaCompare across multiple geodatabases. Each database has its own unique "test" (template) database. And, because the tool just outputs a folder with the same name, it needs to be in its own folder.

Basically, what I want it to do is compare Database1 to Template1, output the report into Folder1. Then, Database2 to Template2, output the report to Folder2, on down the line for all 100 databases. 

Using the workspace iterator I was able to get to compare Database1 to Template, then write the Schema to Folder, then compare Database2 to Template, and then overwrite the first report to create another report in Folder.

I know you can not have more than one iterator in a model when using model builder. Because of this, is my task impossible? Am I going to have to go bother my Python guy to see what he can develop for me?

0 Kudos
3 Replies
curtvprice
MVP Esteemed Contributor

The way to nest loops in Model Builder is to embed models in one another. Both the main model and submodel have their own iterators.

Integrating a model within a model—Help | ArcGIS Desktop 

If You Are Stuck At If

GinnyHarris1
New Contributor

I have attempted to use the examples included in the reply, and I just can't figure out where I am going wrong. Each iterator in the submodels works when it is in the main model. I just can't figure out how to get them to work when I add it is as a submodel. Basically what happens is that it seems it iterate through my whole list of databases, but then only runs the compare on the very last databases in the list and puts them in the folder on the list. Based on my research I'm assuming what I'm missing are preconditions. But, I haven't quite figured out where those fit into this.

Because it is sensitive data, I can't include that. But, I have attached my toolbox.

0 Kudos
curtvprice
MVP Esteemed Contributor

Be sure you are using generating unique output names (ie dataset%n%)  and using the Collect Values tool on the submodel, or all you get out is the last result after the submodel iterates.