In ModelBuilder for ArcGIS Pro, I'm trying to create an iterative model for merging pointfiles according to their names. This is a pre-processing step to handle echo-soundings, spread over one or multiple files per lake, for the creation of lake-bathymetric maps.

The idea is to keep the point.shp files named according to "LakeName_n"(where LakeName = actual lake name and n=numerical order of files) in a folder named "LakeName" which is then kept in a main working directory. To use the model you'd only have to give the path to the main working directory for it to then go through each of the "LakeName" folders and merge (all) the LakeName_n.shp for each lake individually.

I have made a nested model that collects the values/files that are then to be used in the merge (img. 1 & 2).

Nested model to collect files to be merged

Model used for merging the collected pointfiles

I have gotten so far as to be able to either merge all the .shp files from all of the folders together or, by using wildcard, managing to do it for just one of the "LakeName" folders. But I can't seem to make this last atempt iterative. I.e. making a separate merged output for each lake.

I have tried using only the Name variable as input to both the Collect and Merge functions.

I have tried simply using %Name%* and also (by using parse path) %Workspace_name%* as wildcards, but the wildcard only seems to work if the "LakeName" is excplicitly spelled out for each individual lake.

I have allso tried adding "Iterate multivalues" within the parent modell without success (img. 3).

Adding an iterative process to the parent model

How can I do this?

1 Answer 1


I can think of two approaches to solving this:

1] Embed models within models, you are not limited to 1 level or number of sub-models. So you would iterate over WORKSPACES of type folder and on each iteration feed the folder into your model with the featureclass iterator which collects the shapefiles and that feeds into another sub-model that does the merge. This would the "right way" of doing things.

2] Be slack and accept the limitations of your current logic but simply tag on to the end of the merge tool the Split By Attributes tool and explode out the all merge by lake name.

  • 1
    Thank you for taking your time! I did try nesting and re-nesting models. But I either kept runing in to additional problems by doing this or just simply not beeing able to get the results I was after. The simplest fix to this would have been if I could use %Name% as a wildcard, but that is (from what I gather) not an option. I will look in to the possibilities with "Split By Attributes", thank you for the suggestion! The solution I found most effective was to eventually get hold of someone more experienced in Python than me who wrote a simple script that works like a charm.
    – gydemov
    Commented Dec 11, 2020 at 8:20
  • 2
    I have found that when you are looking for logic that requires loops within loops, modelbuilder gets messy and very difficult. Modelbuildbuilder is great for linear processing. When I need to do complex looping I usually abandon modelbuilder for python as it is much easier to control what loops within what. Sounds like you naturally came to the same conclusion.
    – Hornbydd
    Commented Dec 11, 2020 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.