Iterate Fields (ModelBuilder)

Summary

Iterates fields in a table.

Learn how Iterate Fields works in ModelBuilder

Usage

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

  • The Data Type and Wildcard parameters can be used as filters to limit the fields to iterate.

  • If the Field Names parameter is not defined, the tool will iterate fields that honor the filters, if specified.

  • Duplicate fields in the Field Names parameter will be ignored when the tool executes.

  • This tool has two outputs, Value and Count, that can be used as inline variables (for example, %Value%) in other tools. The Value output is a field type and can be used with other tools that accept a field type value. The Count output is the total number of fields the tool iterates.

  • Geometry fields are not listed in the Data Type parameter but are accessible using the Field Names parameter.

  • If a field is not listed in the Field Names parameter, the Value output will use the first field from the table. If fields are listed in the Field Names parameter, the Value output will use the first field from the Field Names parameter. In both cases, if the first field is the geometry field, it will be skipped.

  • Save tables in edit mode to update fields in the Field Names parameter.

  • This tool accepts inputs with joined tables. Joined tables will generate the field names that honor the Maintain fully qualified field names environment.

  • This tool accepts inputs from a database connection.

  • A message will appear next to the Field Names parameter when any of the following occur:

    • A field does not exist in a table.
    • A field does not match a specified Data Type filter.
    • A field does not match a specified Wildcard filter.
    These messages will appear as warnings on the Iterate Fields tool dialog box and as errors on the Field Names variable dialog box.

Parameters

LabelExplanationData Type
Input Table

The input table with fields to be iterated.

Table View; Raster Layer; Mosaic Layer
Field Type
(Optional)

Specifies the field type used to filter the fields. If a field type is not specified, all fields of the supported field types will be iterated.

  • BlobBLOB fields will be iterated.
  • DateDate fields will be iterated.
  • DoubleDouble fields will be iterated.
  • FloatFloat fields will be iterated.
  • GUIDGUID fields will be iterated.
  • LongLong integer fields will be iterated.
  • RasterRaster fields will be iterated.
  • ShortShort integer fields will be iterated.
  • TextText fields will be iterated.
String
Wildcard
(Optional)

Limits the fields that will be iterated. The wildcard works on both field names and field aliases and is a combination of * and other characters. For example, this parameter can be used to restrict iteration of input field names or field aliases starting with a certain character or word (for example, A* or Ari* or Land*, and so on). An asterisk is equivalent to searching for all the fields. If a wildcard is not specified, all inputs will be returned.

String
Field Names
(Optional)

The list of fields that will be iterated.

Field

Derived Output

LabelExplanationData Type
Value

The field returned by each iteration.

Field
Count

The total number of fields for all iterations.

Long

Environments

This tool does not use any geoprocessing environments.

Licensing information

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