Merge Branch (ModelBuilder)

Summary

Merges two or more logical branches into a single output.

Branching in a model is accomplished by creating a script tool that implements the necessary if-then-else logic. When branching, you may need to merge two branches into a single process. This means that if you test an input using a condition (for example, whether the data exists on the disk, whether the cell size is greater than 30 meters, or whether the field value is 1), it will create two outputs: True, if the condition is true, and False, if the condition is false. If the condition is True, you'll run certain processes and if the condition is False, you'll run different processes, as illustrated below. At any point, only one of the branches will run depending on the condition and the input. The Merge Branch tool is used when it is not possible to determine which branch will run and produce results. The output of both branches becomes the input for the Merge Branch tool. The tool identifies the inputs and passes the last output of a branch that has already run to the next tool. The Merge Branch tool allows any number of inputs and uses the multivalue parameter control.

Learn how Merge Branch works in ModelBuilder

Illustration

Merge Branch illustration

Usage

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

  • The tool checks the list of input variables and returns the first variable that is in the has-been-run state.

  • Merge Branch accepts any data type in its list of values. The output data type is Any Value, which is a generic data type. This means that you can connect the output of Merge Branch to any parameter of any tool. For the connected tool to run, the contents of an Any Value variable must be of the correct data type; it is your responsibility to confirm that the contents are correct for the tool's parameter.

  • Most tools in ArcGIS are empty (without color) when they're added to a model; however the Merge Branch, Collect Values, If Value Is, and If Data Exists tools are not. The Merge Branch tool is always in a ready-to-run state (with color). This is because the input to the tool can be empty, which is considered a valid input.

Parameters

LabelExplanationData Type
In Values
(Optional)

A list of values from different branches. The first ready-to-run state value in the list will be the output of the tool.

Any Value

Derived Output

LabelExplanationData Type
output_value

The first ready-to-run state value from the different branches.

Any Value

Environments

This tool does not use any geoprocessing environments.

Licensing information

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