How to filter Python Toolbox parameter for Tables

741
3
10-13-2017 11:04 AM
JohnDye
Regular Contributor

Trying to set a filter on a Python toolbox parameter to only allow tables to be input.

Currently doing this:

        param0 = arcpy.Parameter(
            displayName="Table",
            name="in_Table",
            datatype="GPTableView",
            parameterType="Required",
            direction="Input")
        param0.filter.list = ["Table"]

However, the filter doesn't seem to work.

0 Kudos
3 Replies
DanPatterson_Retired
MVP Esteemed Contributor

the parameter list looks like the correct form (ie a list of entries)

http://desktop.arcgis.com/en/arcmap/10.3/analyze/creating-tools/defining-parameters-in-a-python-tool...

which begs the question, about 'Table' being the appropriate entry

0 Kudos
JamesMacKay3
Occasional Contributor

I don't believe filters are valid on GPTableView parameters.  Your best bet might be to use Describe in the UpdateMessages method to check whether it's actually a table or table view, then raise an error if it isn't.

0 Kudos
JohnDye
Regular Contributor

Thanks guys. I figured this was probably something that was implemented but wanted to check with the SMEs to make sure I wasn't missing something. Boo, Esri. Fix it. https://community.esri.com/ideas/14090 

0 Kudos