Model Builder - Iterate Feature Classes

3792
3
01-19-2011 03:37 AM
SteveWalker
New Contributor
I want to create a model that iterates through all the layers in my table of contents and clears any features currently selected. I bring the Iterate Feature Classes iterator into my model and link my geodatabase to the tool. The output is shown as the first feature class in the TOC. The tool runs with no errors but my only output is the first layer in my TOC and nothing else. I need the iterate tool to run through each layer in conjunction with the Select Layer by Attribute (Clear_Selection type) or a better tool to make sure there are no features selected prior to moving on to other steps. This is my first use of an iterator so I am sure I am missing something simple.
0 Kudos
3 Replies
DuncanHornby
MVP Notable Contributor
Steve,

What you are asking is not possible. The iterators work with FeatureClasses in their workspace. But to visualise a selection you are working with a FeatureLayer. If you look at the input requires of the SelectByAttribute tool that takes a FeatureLayer and not a FeatureClass.  A tool to iterate over FeatureLayers does not exist.

Duncan
0 Kudos
AllenPoling
New Contributor II
I'd try using a MultiValue iterator. To limit the values to feature layers you can create a stand alone variable having a feature layer data type and connect the variable to the Input Values parameter of the Iterate Multivalue as described in the Help topic Iterate Multivalue.
0 Kudos
DuncanHornby
MVP Notable Contributor
Allen,

Good call, I've never used the MultiValue Iterator. Looks like a very useful tool.

I've attached a screen shot of my model that would cycle through all the FeatureLayers in the map document clearing any selections.

Duncan
0 Kudos