I have created a script tool from some python code, and in a previous question, I learned how to enable a drop-down list in this tool by changing the Validation code - see link and image below:
Now I would like to have the second user-input in the tool have its own drop-down list whose members change depending upon the choice in the first input - see image:
For example, if the user chose the town "Winooski", I would like to store that input as a variable, maybe called 'name', which might then be included in a block of code like this:
name = self.params roads = "Z:\\OPS\\TechnicalServices\\Culverts\\GetCulverts\\GetCulverts.gdb\\%s" % name rows = arcpy.SearchCursor(roads) self.params.filter.list = sorted(list(set(r.getValue('CTCODE') for r in rows))) del rows
In the 'roads' directory defined in this code, I have a feature class for every town name, which only includes the roads for that town - so the tool will have the user choose a town, and they will then be presented with a list of state roads in that town to choose from. I tried sticking the above code within the Validation code just beneath the block of code that solved my first problem (in the first image above). I'm assuming that the Validation code only runs when you first open the tool. Any clues as to where I should be sticking some code to do this (maybe in the code for the tool itself..?), or how I should be modifying the small block I wrote?