I am using ArcMap 10.3.
I have created a multi-value choice list following this blogpost:
https://blogs.esri.com/esri/arcgis/2012/07/16/generating-a-multivalue-choice-list/
I changed the validation code to my needs but now I am stuck. Basically I want the script to use the selected values of the choice list and 1) change them all to a another field value (optional) 2) apply a select analysis on it.
My validation code so far looks like this:
import arcpy
class ToolValidator(object):
"""Class for validating a tool's parameter values and controlling
the behavior of the tool's dialog."""
def __init__(self):
"""Setup arcpy and the list of tool parameters."""
self.params = arcpy.GetParameterInfo()
def initializeParameters(self):
"""Refine the properties of a tool's parameters. This method is
called when the tool is opened."""
return
def updateParameters(self):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
if self.params[0].value and self.params[1].value:
self.params[2].filter.list = sorted({row[0] for row in arcpy.da.SearchCursor(self.params[0].value, self.params[1].value.value) if row[0]})
def updateMessages(self):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
My user interface looks like this:
How can I do this?
Update: The part of the script, where I don't know what to do:
inputFC= arcpy.GetParameterAsText(0) #input Feature Class, type: feature layer
inputField =arcpy.GetParameterAsText(1) #input Field, type: Field
Values = arcpy.GetParameterAsText(2) # field values, type: String
OutputFC = arcpy.GetParameterAsText(3) #output, type: feature layer
where = "\"inputField"\" = Values
arcpy.Select_analysis(inputFC, OutputFC, where)
The problem lies in the parameters of the select_analysis part. I don't know how to access the values the user selected to use them in an SQL statement.