ModelBuilder has a built-in understanding of which processes in your model need to run first so that dependent processes have the data needed to run successfully. This happens automatically as you make connections using the output of one tool as the input to another tool. However, occasionally you may need to control the order of operations between two related but disconnected processes. In such cases, preconditions can be used to explicitly control the order of operations. A process can be made to run after another process by making the output of the first process a precondition to the second process. Any variable can be made a precondition to tool execution, and any tool can have more than one precondition.
Set a precondition
In this example, two separate but related processes will be connected using a precondition so that one process executes before the other. The first string of processes creates a new feature dataset within a new file geodatabase. The second process clips a feature class to a study area and writes the output to the newly created feature dataset.
If the model above is executed as-is, there is no way to control the order of operations. The Clip tool may execute before its output location is even created, resulting in an error.
In the model below, the Output Feature Dataset variable must be made a precondition to the Clip tool. By doing this, the Clip tool will run after Create Feature Dataset and the Output Feature Dataset has been created.
To make a variable a precondition of a tool, use one of the following techniques:
- Click on the desired variable and while holding the left mouse button move the cursor to the tool, then release the mouse button on top of the tool to make a precondition connector line between the variable and tool.
- Open the tool by double-clicking the tool, or right-clicking and clicking Open. Click the Properties tab, then click the Precondition drop-down arrow to select the variable. You can add multiple preconditions if needed. When you click OK, a precondition connector line appears between the variable and tool.