Control the default values for a multivalue input parameter within a Python script-based tool
Last Published: April 25, 2020
Summary
Instructions provided on how to use the ToolValidator class to populate default values into the tool dialog for a script-based tool.
Procedure
Using the initializeParameters and updateParameters methods, the default values for a mutivalue parameter can be created and controlled.
To add custom behavior for your script tool, right-click the script tool, click Properties, then click the Validation tab. On the Validation panel, you can provide Python code that implements a Python class named ToolValidator.
In the Python editor, edit the initializeParameters method code block to create a filter list of acceptable values for the corresponding parameter:
To make some or all of the filter list values selected by default, pass in a string, separated by semicolons into the parameter:
The result of the edited ToolValidator class is a parameter that is updated and set upon opening of the script tool dialog:
Article ID:000011291
Software:
ArcMap
Receive notifications and find solutions for new or common issues
Get summarized answers and video solutions from our new AI chatbot.