Randy_NRG

Constraining ToolValidator's updateParameters(self)

Discussion created by Randy_NRG on Feb 15, 2011
Latest reply on Feb 18, 2011 by dhoneycutt-esristaff
I would like to automatically adjust one parameter in a script tool, only when one other parameter is altered.

What is happening is that ANY alteration to any parameter is causing the one parameter I want to change to change.

I only want the parameter[0] to change if parameter[1] is changed, not when any other parameter is changed.

I thought I could do this with "altered," but this is not working. Any change to any parameter triggers the automatic adjustment to parameter[1].

Code is show below. Is what I am trying to do possible? Have I made a mistake so blindingly obvious that it can be seen without much effort on the part of a more knowledgable scripter?

Thank you for your time.

  def updateParameters(self):
    """Modify the values and properties of parameters before internal
    validation is performed.  This method is called whenever a paramater
    has been changed."""
    if self.params[1].altered:
      self.params[0].value = "Quick_"+self.params[1].value
    return

Outcomes