3

In an ArcGIS Python Toolbox (pyt file), how do I specify a filter for a Value Table parameter? In my value table I have two columns. The first is a a field name derived from a selected table view and the second is a argument that should pass through with the field name. I would like to filter the list of available fields by data type, and then define a pick list of values for the second field.

I've searched high and low, but setting a filter for a value table is not obvious, or it may not be possible. When I attempt to specify a filter list for the field datatype in the usual way the toolbox fails to load with an error message of "line 118, in getParameterInfoAttributeError: 'NoneType' object has no attribute 'list'". Where line 118 is where I try to specify the filter as in the code below.

I can specify list of values to populate the table, but I really need this to be user selected.

field_map = arcpy.Parameter(
        displayName='Output Field Map',
        name='out_field_map',
        datatype='GPValueTable',
        parameterType='Required',
        direction='Input')
field_map.columns = [['Field', 'Field Name'], ['GPString', 'NVEL Attribute']]
field_map.parameterDependencies = [trees_table.name]
#specifying a filter list fails
#field_map.filter.list = ['Short', 'Long', 'Float', 'Double']

1 Answer 1

4

Filters on Value Tables won't be available until 10.2.1. They'll be accessible as Parameter.filters, which will be a list of Filter objects the same as Parameter.value exists right now for single input parameters.

6
  • Thanks. Unfortunately that was the answer I expected. Any suggestions on an a workaround?
    – tharen
    Oct 3, 2013 at 21:02
  • What I've done before is have a set of inputs above the value table (feature layer and field), once a layer is selected it populates the field input, and once a field is selected it clears out the two controls and adds a row to the value table. Hacky but worked okay for me. Oct 3, 2013 at 21:24
  • That doesn't sound too bad. Thanks.
    – tharen
    Oct 3, 2013 at 23:11
  • It's been a while since this question was first asked, and in the meantime 10.2.2 has been released. Is it now possible to filter on Value Tables?
    – mollys
    Aug 6, 2014 at 21:12
  • 1
    At 10.2.2 it is not working (at least not like it does at 10.3). At 10.3 it is working with syntax like: param2.filters[0].type="ValueList" param2.filters[0].list = ["X"] to set the first column and param2.filters[1].type="ValueList" param2.filters[1].list=["x"] to set the second column. Thomas, how did you get it to work at 10.2.2? May 11, 2015 at 16:16

Your Answer

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

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