Use feedback loops

In ModelBuilder, the output of a process can be used as an input to a previous process. This is known as feedback, since an output is fed back to a previous process as input.

Create a feedback loop

You can create a feedback loop by connecting an output variable of one process to the input variable of the same process. To make this connection, click and hold the mouse button on the output variable, move the pointer to the input variable, and release the mouse button when the pointer is over the input variable. The model automatically creates a dotted blue feedback connector line when the output is connected to the input. Every time the tool iterates, the output variable is used as input for the next iteration.

Since the model produces one output dataset for each iteration, it is important to have a unique output name for each iteration so the previous iteration output is not overwritten. To assign a unique name to each iteration output, append the output path with the inline variable substitution, as shown in the example below.

Use a feedback loop to create multiple buffer rings

The example model below shows how to use the Buffer tool and a feedback loop to iteratively create multiple rings of buffers.

Using feedback loop
The Buffer tool and a feedback loop are used together.

  1. To run the feedback loop a specific number of times, use the For tool. Enter an appropriate value for From Value, To Value, and By Value.

    For example, to iterate the model four times, set a starting From Value of 1, an ending To Value of 4, and an interval By Value of 1.

  2. Make the output of the For tool a precondition to the next tool.

    This ensures that the iteration number is available before the next tool executes.

  3. To avoid overwriting the output of each iteration, append the output name with the %Value% inline variable.

    When the model runs, %Value% will be replaced by the number from the output Value of the For tool.

  4. Connect the output of Buffer to the Input variable as feedback so the previous buffered output is used as input in the next iteration.
  5. Connect the output of Buffer to the Collect Values tool.
  6. To run a model with a feedback loop from the Geoprocessing pane, connect the final output of the model to the Collect Values tool. Make the output of Collect Values a model parameter so the feedback outputs are added to the map.
  7. Run the model.