I am running a model iterating through N feature clases and I get N tables as output. The model works properly. Here it is:
I need to merge this tables into a new one, thus I would run my model as submodel. However, when I add it to the new model something goes wrong:
I am still learning modelling and programming skills, thus any help, suggestions, clarifications are more than welcome!
I take it that both your models when executed individually work properly?
You can add the Model 1 and Model 2 in a new model with the Pre-Condition that model 1 should execute first and then invoke the second model. This should work in principle.
Alternatively, you can run them as two separate models, but I doubt you want to execute the models particularly in that fashion. The best way to get this done will be to create a python script and execute which has the workflow lined up as per your requirement.
I hope this helps!
Thanks for your suggestion. The first model works properly and returns N output tables; if I apply the merge tool to the output tables it works, too, but for some reason I cannot combine the two into one model in order to automatize the process.
There was a similar question some time ago (Merge all iteration output to single output in modelbuilder), but it doesn't work either.
The output tables from the first model do they have the same schema?
If they do you can simply use the Append—Help | ArcGIS Desktop instead the merge. Maybe, the merge doesn't play well with the first half of the model. Besides append is the best way to go when it comes to merging data with same schema.
You are almost correct. You have correctly identified that your main model with the iterator needs to be a sub-model in a model with a single Merge tool. Merge takes a LIST of inputs which you merge. So how do you create a LIST of tables? There is the model only COLLECTS VALUES tool. Tag that to the end of your output table IN you sub-model and expose it's output as a parameter. Drag that sub-model into a new model with just a merge tool and you will see that the sub model has a LIST output which simply connects to the input parameter of Merge.
Thanks for your suggestion! It still doesn't work, as it seems that the fact that during the model the variable 'out_stats_%N%.dbf' is manipulated several times generates some kind of conflict when I run it as submodel. I cannot set them as intermediate variable (which I guess would solve the problem); I have read in some other post that that would be possible by setting the environment, but I am not so far with Model Builder and I would not know what to change. I would be very grateful if you could help me!