I managed to create two drop down lists using the validation code where an user can select the first parameter from a list and get another filtered list for the second parameter.

However, I am struggling with the passing the selected second parameter as an input to the python script.

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."""

accounts = "Database Connections\\someDatabase.sde\\TableToFilter"
rows = arcpy.SearchCursor(accounts)
self.params[0].filter.list = sorted(list(set(row.getValue('USERID1') for row in rows)))

if self.params[0].altered:
    rows = arcpy.SearchCursor(accounts, """ "USERID1" = '""" + self.params[0].value + "'")
    accountList = sorted(list(set(row.getValue('ACCGRPNAME') for row in rows)))
    self.params[1].filter.list = accountList
    self.params[1] = self.params[1].value

#del rows

I am using self.params[1] = self.params[1].value to pass the selected value to the rest of the script but I'm not sure I am doing the right thing.

How would you retrieve the selected value and pass it to the script?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.