I am using ArcMap 10.3.1.
I have two parameters for my script tool. The first is the type of product to be created, the second is the scale of the product. Digital Map / No scale required are the default values defined in the Tool Validator code.
If it is a paper product, the user selects the appropriate scale from the drop-down list. As it exists now, the problem I can't solve is that if the user changes the value of parameter 0 to paper map, the list of scales from the list becomes available but the value is still the default ("No scale required") so an error is thrown because that option is not in the scale list. The error clears when I select the scale from the list, but I want only those choices available and obviously don't want the error to appear at all.
Likewise if I then change parameter 0 back to Digital Map the "No scale required" value appears but the error message is thrown again because that value is not in the scale list, which is somehow still appearing. There is no way to clear the error at this point.
Ideally it works as follows: If user picks Paper, only the scales appear. If user switches back to Digital, only the "No scale required" value appears. And so on with switching back and forth (because I can't guarantee my users' behaviour). How can I get these different combinations to appear and change as intended without any errors.
import arcpy class ToolValidator(object): def __init__(self): self.params = arcpy.GetParameterInfo() def initializeParameters(self): # Define the list of product types the user can choose from self.params.filter.list = ["Digital Map", "Paper Map"] self.params.value = "Digital Map" return def updateParameters(self): if self.params.value == "Digital Map": self.params.value = "No scale required" if self.params.value == "Paper Map": self.params.filter.list = ["1:10,000", "1:25,000"] return def updateMessages(self): return