Using a ValueTable to provide multivalue input to a tool
Many geoprocessing tools have input parameters that accept more than one value. For example, the multiring buffer tool accepts multiple buffer distances, the delete field tool accepts multiple fields that can be deleted, and there are many other examples. In this recipe, you will learn how to create a ValueTable
object that serves as multivalue input to a tool.
Getting ready
There are three ways to specify a multivalue parameter: as a Python list, a string with each value separated by semicolons, or an ArcPy ValueTable
object. In this recipe, we're going to take a look at how to specify mutlivalue input parameters by using ValueTable
.
How to do it…
Follow these steps to learn how to use a ValueTable
to submit multiple values to a tool:
Open IDLE (or your favorite Python development environment) and create a new script called
ValueTable.py
.Import
arcpy
and set the workspace:import arcpy arcpy.env.workspace = r"c:\ArcyBook\data"
Create a...