Examples of using ModelBuilder utilities

Collect Values

In the following example, the Collect Values tool is used to create a new mosaic from 99 rasters stored in the Input_CollectValue workspace (the Input Rasters variable). The Iterate Rasters tool iterates through each of the rasters in the workspace, and all the rasters are collected using the Collect Values tool. The output of Collect Values, Collected Values, is a multivalue of rasters and is input to the Mosaic To New Raster tool. Using Collect Values in this way requires creating a submodel and making the output of Collect Values a Model Parameter.

How to use the Collect Values tool

Get Field Value

In the following example, the Get Field Value tool is used to find the percentage area of each polygon in a feature class.

The Input variable is a polygon feature class to the Summary Statistics tool, and the output Sum Area is a table with one record containing the total area of all polygons. This output is connected to the Get Field Value tool.

The Get Field Value tool gets the first value from a table of the specified field, and the value is then used as an inline variable in the expression of the Calculate Field tool to find the percentage area of each polygon.

How to use the Get Field Value tool

Parse Path

In the following example, the Parse Path tool is used to parse the input (C:\1Tool Data\InputFC.shp) to a file name, extension, path, and workspace name. The Path output has a workspace data type and is connected directly as an input parameter to the Feature Class Location parameter of the Create Feature Class tool, which accepts a workspace data type as an input. For Copy, which does not have a workspace data type parameter, the Path is passed to the tool using %Path%\Out_%Name%.%Extension%.

How to use the Parse Path tool

Select Data

In the following example, the Select Data tool is used to copy two shapefiles to a geodatabase and merge one of the feature classes with another feature class. The Select Data tool is used to select one of the two feature classes in the geodatabase and pass it to the Merge tool.

How to use the Select Data tool

Stop

The Stop tool stops the iteration of a model based on a condition. In this example, the For iterator is used to iterate values from 500 to 4000 and increment by a value of 500. At the first iteration, the Value variable is 500, then 1000, then 1500, and so on. This value is used as a buffer distance. The Summary Statistics tool is used to calculate the sum area of all the polygons, and Get Field Value is used to get the value from the summary statistics table. Calculate Value is used to calculate a Boolean true if the Sum Area value exceeds 40. The Stop tool is set to stop model execution if the condition set in Calculate Value is true. The model iterates for each value, and at the fourth iteration, in this example, the total area of all polygons exceeds 40, making the condition true. The Stop tool exits the model at this point.

How to use the Stop tool