Model Builder: Merge feature classes coming from a submodel as fc_%n% into one table

2515
4
Jump to solution
02-08-2017 07:34 AM
PhilippZacharias
Occasional Contributor

Hello,

I'm trying to merge feature classes, that come from a submodel ("PFA_findBiggest") via inline variable substitution. They are saved in a GDB.

They all have different fields. I want to merge them into one big table according to a fishnet_FID, that they all carry.

Here you can see, I tried the merge function in order to merge them into a feature class, but this didn't work. It only ever 'merged' the first %n%, which of course is 0, and nothing else. So the output of Merge is identical to the first layer processed.

I guess it's because Merge doesn't know that more is coming. That's why I have put the Collect Values in between. It is set to:

Why is this not working?

0 Kudos
1 Solution

Accepted Solutions
DuncanHornby
MVP Notable Contributor

Your sub model PFA_findBiggest needs to be in a sub-model itself, looping and ultimately providing a single output (collect values) as a parameter. Then you have a list of datasets ready to feed into the merge tool as that need only run once.

View solution in original post

4 Replies
DuncanHornby
MVP Notable Contributor

Your sub model PFA_findBiggest needs to be in a sub-model itself, looping and ultimately providing a single output (collect values) as a parameter. Then you have a list of datasets ready to feed into the merge tool as that need only run once.

curtvprice
MVP Esteemed Contributor

Duncan is right on here, the Collect Values tool needs to be inside a sub model that returns the collected values as a returned output parameter. There is an example of this in the help on model interators.

PhilippZacharias
Occasional Contributor

Duncan HornbyCurtis Price

Thanks guys. I remember that I ended up doing it all in python using arcpy directly.

curtvprice
MVP Esteemed Contributor

That's great. Model Builder is really useful, but sometimes your workflow just requires a Python script!

0 Kudos