Modelbuilder: Collect values

4854
3
05-17-2016 10:13 PM
PV
by
New Contributor III

I have a large model with submodels.

Basically the Model iterates through all Districts, selects in each district an attribute above a certain threshold, creates a layerfile of it. The submodel iterates through all the Attributes of the created layerfile and then selects the neighbor of this attribute below a certain threshold and creates another layerfile of it.

In the end I want to merge the layerfiles. I though of using a collect value tool to collect all the layerfiles (red circle) which got created in the iterations in the submodel and then add a Merge tool to it in the main model ( or should it be in the submodel)? However, I get no result if I add it to display.

The whole Model works if I just run it and see the result for the last run in the iterator.

Can anyone help me with this? I attached the model but the jpeg probably doesn't make any sense as the text is too small.

Crossposted on Stackexchange: Modelbuilder ArcGIS: Collect values - Geographic Information Systems Stack Exchange

Mainmodel:

Mainmodel.jpg

Submodel:

submodel.jpg

0 Kudos
3 Replies
curtvprice
MVP Esteemed Contributor

Are you naming the layer files uniquely be using the run number --  layer%n%  ?  If you don't do that the layer just gets overwritten over and over again.

I am a little confused as I don't see why you have two inputs to the Collect Values tool. Normally you would only have one, and each iteration would add one to the stack. You don't have a precondition to control flow of execution so I your flow of control is kind of strange.

I recommend attaching your tbx - then we can open it up and really see what's going on instead of guessing from your screen shots.

The merge should be in the main model. See the example in the help here:

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

0 Kudos
PV
by
New Contributor III

I tried to name it like you suggest above, but I probably did it wrong as it does not work..
The toolbox is now attached in the question

I want all the inputs into the collector to merge after they pass the tool. The Inputs are from different layerfiles. I attached the toolbox where I use an append first now, however this causes a "read-only" error.

I am not sure why I should use a precondition? As I understand from Preconditions—ArcGIS Pro | ArcGIS for Desktop , a precondition is only used if you have disconnected processes - which is not the case in my model.

0 Kudos
curtvprice
MVP Esteemed Contributor

Layers are dynamic and point to datasets, they are not data sets themselves. I think your approach of trying to work entirely with layers is getting you into trouble -- it would make a lot more sense to create temporary feature classes and put them into the collector.

I suggested a precondition because I misinterpreted your cut-off graphic.

0 Kudos