Select to view content in your preferred language

Iteration

827
5
Jump to solution
07-16-2013 08:15 AM
MarkYoung
Regular Contributor
Hi,
I have a feature class with a few polygons (search areas).
I have various other feature classes containing constraint data.
What I want to do is build a model which uses each search area as clip features and the various constraints as the input features so that there is a separate feature class created for every clip area with all the constraints features it intersects. After the clip I would merge all clip results then dissolve based on the common fields outputting to a table. Its the actual iteration of which feature class I am trying to figure out.

Any help would be most appreciated.
0 Kudos
1 Solution

Accepted Solutions
ShitijMehta
Esri Regular Contributor
Hi,
There are two things to change in the model:

The rule is "The tools that only need to be run once should be placed in the main model, which calls the iterating submodel." Merge and Dissolve (I am assuming) need to be run just once so they should be in the main model which calls the sub model containing an iterator. Any tool placed in the same model as the iterator will run as many times as the iterator runs and I think you don't want the merge and dissolve to run more than once. Read the Advanced use of Iterator section from the link.

Since you are using the iterator the Value output of the iterator (cyan color) has the value of the field over which you are iterating it can be used in the output for clip C:\Temp\Out_%Value%.shp using inline variable substitution.

View solution in original post

0 Kudos
5 Replies
MarkYoung
Regular Contributor
Eventually got this working (see searches.jpg image below)  but one final flaw..
When I output to individual shape files, there is no way of telling which search relates to what data.
I use \\shpname%n%.shp and that creates individual outputs.
There is a field in the searches feature class with a unique search number. Is there any way to pass that unique search number to the output shape files - perhaps incorporate into the \\shpname%n%.shp output path?
0 Kudos
ShitijMehta
Esri Regular Contributor
Try the tool Get Field Value after selection and use the output of the tool as inline variable substitution in the output path name.
0 Kudos
MarkYoung
Regular Contributor
Hi,
Added the get field tool and specified the [REF] field but am unable to connect that output to anywhere. Where do you mean when you say use the get field tool after selection?
Thanks
0 Kudos
ShitijMehta
Esri Regular Contributor
Hi,
There are two things to change in the model:

The rule is "The tools that only need to be run once should be placed in the main model, which calls the iterating submodel." Merge and Dissolve (I am assuming) need to be run just once so they should be in the main model which calls the sub model containing an iterator. Any tool placed in the same model as the iterator will run as many times as the iterator runs and I think you don't want the merge and dissolve to run more than once. Read the Advanced use of Iterator section from the link.

Since you are using the iterator the Value output of the iterator (cyan color) has the value of the field over which you are iterating it can be used in the output for clip C:\Temp\Out_%Value%.shp using inline variable substitution.
0 Kudos
MarkYoung
Regular Contributor
Hi,
Thank you so much for your help. I now have a main model (merge and dissolve) which outputs to a feature class. This 'calls' the sub model which uses the output feature class as the input features and runs the row iteration as clip features outputting individual files by the name in the [REF] field.

Mark
0 Kudos