AnsweredAssumed Answered

Conditional Drop Down Lists - Tool Validator

Question asked by rnz.macdonaldca on Mar 7, 2018
Latest reply on Apr 21, 2020 by rknapik_orsip

I'm trying to use the ToolValidator function to update the content of the drop down lists. I've followed the steps from  but need to take it a step further and populate the 'HA' drop down list with the values in the 'HarvestArea' field that start with the 'ForestID'. 


Any help on how to format this in the ToolValidator script (see below) would be much appreciated! 



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()
    self.fcfield = (None, None)

  def initializeParameters(self):
    """Refine the properties of a tool's parameters.  This method is
    called when the tool is opened."""


  def updateParameters(self):
    """Modify the values and properties of parameters before internal
    validation is performed.  This method is called whenever a parmater
    has been changed."""

    if self.params[0].value and self.params[1].value:
      fc, col = str(self.params[0].value), str(self.params[1].value)
      if self.fcfield != (fc, col):
        self.fcfield = (fc, col)
        self.params[2].filter.list = [str(val) for val in
                                            for row in arcpy.SearchCursor(fc,
        if self.params[2].value not in self.params[2].filter.list:
          self.params[2].value = self.params[2].filter.list[0]

  def updateMessages(self):
    """Modify the messages created by internal validation for each tool
    parameter.  This method is called after internal validation."""