Hi,
I was wondering if there was a way to set up the script tool parameters to update a multiple choice selection list based on a fields attribute values. I think I set it up correctly ( by all means correct me if it is wrong ) but it doesn't seem to be working accordingly. I might be missing something, but since I generally never mess with this, it is a bit foreign to me. Any help on this would be greatly appreciated.
class ToolValidator:
# Class to add custom behavior and properties to the tool and tool parameters.
def __init__(self):
# set self.params for use in other function
self.params = arcpy.GetParameterInfo()
def initializeParameters(self):
# Customize parameter properties.
# This gets called when the tool is opened.
return
def updateParameters(self):
# Modify parameter values and properties.
# This gets called each time a parameter is modified, before
# standard validation.
if params[3].value:
fcfields = [field.name for field in arcpy.ListFields(params[3].value) if field.name == params[4].valueAsText]
attributevalues = [row for row in arcpy.da.SearchCursor(featureclass, fcfields)]
self.params[5].filter.list = set(attributevalues)
return
def updateMessages(self):
# Customize messages for the parameters.
# This gets called after standard validation.
return
# def isLicensed(self):
# # set tool isLicensed.
# return True
Thanks