For some reason I am running into an issue on a filter list for my tool box.
Below is my Code:
def getParameterInfo(self): """Define parameter definitions""" prod = "\\hqstore\geostore\Software\Scripts\Python_Toolbox\ConnectionFiles\PRODUCTION_10.2.2_GISUser_Default.sde" test = "\\hqstore\geostore\Software\Scripts\Python_Toolbox\ConnectionFiles\Test_10.2.2_GISUser_Default.sde" dev = "\\hqstore\geostore\Software\Scripts\Python_Toolbox\ConnectionFiles\Dev_10.2.2_GISUser_Default.sde" from_database = arcpy.Parameter( displayName = "From Database", name = "From_Database", datatype = "DEWorkspace", parameterType = "Required", direction = "Input") #from_database.filter.type = "ValueList" #from_database.filter.list = [prod, test] to_database = arcpy.Parameter( displayName = "To Database", name = "To_Database", datatype = "DEWorkspace", parameterType = "Required", direction = "Input") #to_database.filter.type = "ValueList" #to_database.filter.list = [test, dev] parameters = [from_database, to_database] return parameters
any ideas why this is not working? the filters are commented out... so my tool works
# Ignore my spacing it is just how the copy paste ended up
Solved! Go to Solution.
The error you're seeing is expected. When using a parameter of type workspace the only filter values that you can use are to filter the type of workspace supplied (i.e. File System, Local Database, or Remote Database).
You'll want to use a parameter type that allows you to have a dropdown with known paths, such as GPString.
This is documented on the following page and holds true for both script tools and python toolboxes.
Defining parameters in a Python toolbox
Setting script tool parameters (Script tool equivalent to the above documentation)
** Screenshot of filters that become available in the UI against a parameter of type DEWorkspace. **
The error you're seeing is expected. When using a parameter of type workspace the only filter values that you can use are to filter the type of workspace supplied (i.e. File System, Local Database, or Remote Database).
You'll want to use a parameter type that allows you to have a dropdown with known paths, such as GPString.
This is documented on the following page and holds true for both script tools and python toolboxes.
Defining parameters in a Python toolbox
Setting script tool parameters (Script tool equivalent to the above documentation)
** Screenshot of filters that become available in the UI against a parameter of type DEWorkspace. **
Thanks for the Info!!! That worked.