A quick tour of advanced techniques in ModelBuilder
ModelBuilder provides functionality to make simple or complex models even more productive through the use of a number of advanced techniques. These advanced techniques improve models by adding more control to the model's logical flow, better mechanisms for managing model data, and time-saving methods for performing repetitive tasks automatically.
Inline variable substitution
In ModelBuilder, contents of a variable can be used as a substitute for another variable by enclosing the substituting variable in percent signs (%). Substituting variables in this manner is called inline variable substitution. A simple case of inline variable substitution is replacing some text or a value in a model with user input.
Lists
ModelBuilder supports the use of list variables, which can contain multiple values.
Iteration
Iteration, often referred to as looping, means to repeat a process over and over with some degree of automation. Iteration is very important because automating repetitive tasks reduces the time and effort required to perform the tasks. With iteration in ModelBuilder, a process can be executed over and over using different settings or data in each iteration. ModelBuilder also provides flexibility in iteration, as an entire model or simply a single tool or process can be executed repeatedly.
Learn more about iteratorsFeedback
You can use the output of a process as an input to a previous process. This is known as feedback, since you feed the output back to the input.
Model Only tools
There are seven geoprocessing tools that support advanced behavior in ModelBuilder. These tools are not for use from the tool dialog box or in scripting.
Preconditions
Preconditions can be used to explicitly control the order of operations in a model. For example, 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.
If-then-else logic
If-then-else logic is a simple yet powerful concept for performing different actions based on different conditions. If-then-else logic can be explained as such: IF some condition is true, perform an action; ELSE the condition is false, perform a different action.
In ModelBuilder, if-then-else logic can be implemented by writing a script tool that tests some condition, then outputs two Boolean variables that describe the true and false condition and incorporating this script tool in a model. As an alternative to writing a script tool, you can also use the Calculate Value tool to test the condition and output a Boolean.
Feature Set and Record Set
Feature sets allow features to be entered interactively and immediately used as input to a model or script. This interactive data entry is done through a process similar to editing features inside ArcMap. Similarly, record sets allow tabular or attribute information to be entered interactively and immediately used as input.
In-memory workspace
ArcGIS provides an in-memory workspace where output feature classes and tables can be written. Writing geoprocessing output to the in-memory workspace is an alternative to writing output to a location on disk or a network location. Writing data to the in-memory workspace is often significantly faster than writing to other formats such as a shapefile or geodatabase feature class. However, data written to the in-memory workspace is temporary and will be deleted when the application is closed.
Integration of model, scripts, and external programs
Model tools are fully integrated into the geoprocessing framework and can be used in the same ways all system or script tools can. Like all other geoprocessing tools, model tools can be executed from a dialog box, through Python scripting, or added and run in another model. Just as system tools can be added and executed in a model, Python scripts and external programs accessed through scripts can be integrated within a model.