Advance Model Builder Features Advance Features • • • • • • • • • • Using Lists (also Batching) Iteration Feedback Model Only Tools Inline Variable Substitution Preconditions Feature Set and Record Set If-then-else logic In-memory workspace Integration of model, scripts and external programs Using Lists • A variable that contains one or more values is called a list variable. It is a property of a variable • When an output list variable is created in a model, you can use %i% as in-line variable substitution in the output name. %i% appends the list number at the end of output name. Using Lists • The model is now ready to run from within ModelBuilder. The model will execute for each input contained in the Input Feature Class list variable. Using Lists • It is my opinion that Lists are best used from multi-step, but “short” processing. • Use the %i% to create unique output for each list “input”. %i% starts at zero (%0%) Batch Processing • In ArcGIS batch processing means to execute a single tool multiple times with different inputs without your intervention. • In ArcCatalog or ArcToolbox, right-click a tool and click Batch. This will open the batch window, where you can set up multiple runs for the tool. When you open the batch window for a tool, one row is automatically added, ready to accept input. The following example uses the Clip tool. Batch Processing • Entering parameters: To enter the parameters for an entire row, double-click the row header to open the tool's dialog, as shown below. Alternatively, you can rightclick the row header and click Open. Use the dialog to enter one or more of the parameter values. Click OK Iteration • Iteration or Looping, is to repeat a process over and over with some degree of automation. • There are 12 iteration tools in Model Builder. – For: For iterates over a starting and ending value by a given value. It works exactly like For in any scripting/programming language, executing through a set number of items. – While: While works exactly like 'while' in any scripting/programming language, executing "while" a condition is true. Iteration – Iterate Feature Selection: Iterate Feature Selection tool iterates over features in a feature class. – Iterate Row Selection: Iterate Row Selection tool iterates on rows in a table. – Iterate Field Values: Iterate Field Values tool iterates over each value in a field. – Iterate Multivalue: Iterate Multivalue tool takes a user-specified list of inputs (for example, inputs from different locations or a subset from a single location of any single type) and runs the model for each value. Iteration – Iterate Datasets: Iterates over datasets in a Workspace or Feature Dataset. – Iterate Feature Classes: Iterate Feature Classes tool iterates over feature classes in a workspace or feature Dataset. – Iterate Files: Iterate Files tool iterates files in a folder. – Iterate Rasters: Iterate Rasters tool iterates over rasters in a Workspace or a Raster Catalog. – Iterate Tables: Iterate Tables tool iterates over tables in a workspace. – Iterate Workspaces Iterates over workspaces in a folder. Iteration • Only one iterator can be used per model. • If an iterator is added to a model, all tools in the model iterate for each value in the iterator. • If a model containing an iterator is exported to a Python script, the script will not include the iteration logic. • Using an iterator will set a default value of -1 in Iteration Options in Model Properties, which simply means that the model will run for unlimited times or based on the number of inputs in an iterator, and not on a set number. For • Iterates over a starting and ending value by a given value. It works exactly like For in any scripting/ programming language, executing through a set number of items. • Buffer Example Buffer around Hospitals Basic Model Buffer around Hospitals Add the For Iterator Connect the output Value from the For Iterator to the Buffer tool. You most define the Buff input for the Value . Buffer around Hospitals Define the iteration values In the For iterator Use “Value” as an in-line variable substitution to create a unique output Hosp_buff%Value% Buffer around Hospitals Feedback • 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. Feedback Define number of iterations using the For iterator. Feedback • A feedback variable can be defined from a variable properties or using the connect tool. • %n% can be used to insert a systems variable corresponding to the iteration number. Feedback