Using the Validator in the ArcGIS 10.1 tool GUI, can I loop through and List feature classes from a workspace type parameter (ie a file geodatabase) and then go on and list the values of a field in a feature class from that list? I'm trying to do this:
if self.params[0].value and arcpy.Exists(self.params[0].value):
for fc in arcpy.ListFeatureClasses(self.params[0].value):
if fc == "TestFC":
value_set = set(row.getValue("SITE")
for row in arcpy.SearchCursor(str(self.params[0].value)))
self.params[1].filter.list = sorted(value_set)
where param[0]
is a workspace type parameter where the user chooses a geodatabase. param[1]
will be a string type parameter set as a value list. I want to read in a setted value list from all the values in the 'SITE' field so the user can choose which site the tool will further process on.
Maybe in other words:
- User opens tool
- User chooses a file geodatabase as the first parameter
- User will then choose a SITE from the list derived from the first parameters testfc feature class, 'SITE' field