I'm just trying to set up the parameters in a tool I've built in ArcGIS. What I want to do is read in a feature class or table and get the values in a specific field called "SITE". The field contains a bunch of site names. What I want to do is read in the values of that field and populate them into the 'Value List' tool parameter property

I've been looking at the tool properties and I though I can use the 'Obtained From' property, but it looks like I can only obtain field names, but not that values in the field.

Is there anyway else to do this?

Is there anyways to read in the values from the SITE field and populate it to a value list programmatically?

1 Answer 1


You're not really supposed to do this, but you could open a cursor in your validator's updateParameters method.

if self.params[0].value and arcpy.Exists(self.params[0].value):
    value_set = set(row.getValue('COL_NAME')
                    for row in arcpy.SearchCursor(str(self.params[0].value))))
    self.params[1].filter.list = sorted(value_set)

This will take some feature layer/table from the first parameter and populate the second parameter's dropdown with a list of values in its COL_NAME field.

Note: this will greatly slow down your validator and is highly discouraged.

  • 1
    Thanks Jason, I took what you suggested and made some adjustments. I was trying to avoid obtaining values from another parameter, so I set a cursor search in the validator on a feature class to loop through and append the values to a list and just sorted(set(variable)) and returned it to self.paramas[0].filter.list. This worked perfectly with no apparent performance issues.
    – Mike
    Mar 5, 2013 at 23:14
  • could you explain this a bit more? what needs to be added to the actual python script.
    – jtgis
    Nov 29, 2017 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.