Iterate Row Selection (ModelBuilder)

Summary

Iterates over rows in a table.

Learn how Iterate Row Selection works in ModelBuilder

Usage

  • This tool is intended for use in ModelBuilder, not in Python scripting.

  • More than one group by field can be used for the selection. If one or more group by fields are selected, the number of iterations is determined by the number of unique combinations of the group by fields. For each iteration, the selection of the output feature layer is determined by the number of records that match the given combination of the group by fields. If more than one group by field is chosen, the values are concatenated <field value1>_<field value2> in the output inline variable name. See an example below where two group fields: CALL_TYPE and Crime_Peri (crime period) are used. The output Value is Vandalism_Morning and so on for the other values.

    Iterate Row Selection

  • If no group by field is chosen, the output value is the group by ObjectID field, and the selection is one record per selection.

  • The tool has two outputs: Selected Rows and group Value of the Object ID field for selected features, which could be used as inline variable %Value% in other tools.

  • If an Iterator is added to a model, all tools in the model will iterate for each value in the iterator. If you do not want to run each tool in the model for each iterated value, create a sub-model, model within a model, or nested model that contains only the iterator and add it as a model tool into the main model.

Syntax

arcpy.mb.IterateRowSelection(in_table, {fields}, {skip_nulls})
ParameterExplanationData Type
in_table

The table containing records to iterate through.

Table View
fields
[fields,...]
(Optional)

The input field or fields used to group the features for selection. Any number of input fields can be defined, resulting in a selection based on a unique combination of the fields. If a field is not specified, the Object ID is used to iterate over features.

Value Table
skip_nulls
(Optional)

Specifies if null values in the grouping fields are skipped during selection.

  • Checked—Skip through all the null values in the grouping fields during selection.
  • Unchecked—Include all the null values in the grouping fields during selection. This is the default.
Boolean

Derived Output

NameExplanationData Type
selection

A table view that can be used in other geoprocessing tools that accept a table view in ModelBuilder.

Table View
value

The field values returned by each iteration. If more than one group by field is chosen, the values are concatenated <field value1>_<field value2>.

Variant

Environments

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes