Iterate Fields (ModelBuilder)

Summary

Iterates fields in a table.

Learn how Iterate Fields works in ModelBuilder

Usage

  • This tool is only available from ModelBuilder for use in models. The tool is not available from the Geoprocessing pane or from Python.

  • 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.

  • 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 the fields to be returned.

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

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

  • Big IntegerBig Integer fields will be returned.
  • BlobBLOB fields will be returned.
  • DateDate fields will be returned.
  • Date OnlyDate Only fields will be returned.
  • DoubleDouble fields will be returned.
  • FloatFloat fields will be returned.
  • GlobalIDGlobalID fields will be returned.
  • GUIDGUID fields will be returned.
  • LongLong integer fields will be returned.
  • RasterRaster fields will be returned.
  • ShortShort integer fields will be returned.
  • TextText fields will be returned.
  • Time OnlyTime Only fields will be returned.
  • Timestamp OffsetTimestamp Offset fields will be returned.
  • XMLXML fields will be returned.
String
Wildcard
(Optional)

Limits the fields that will be returned. 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 returned.

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