[GIS] Field Filter and Value Pick List for a Python Toolbox ValueTable Parameter

arcpypython-toolboxvalue-table

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']

Best Answer

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.

Related Question