1

I would like the parameters in my script to accept both gdb workspaces or feature datasets. I have tried both "DEWorkspace" and "DEFeatureDataset", but both of these accept either gdb or feature datasets, and not both.

Here's a list of all options: http://desktop.arcgis.com/en/arcmap/latest/analyze/creating-tools/defining-parameter-data-types-in-a-python-toolbox.htm

Any idea on how to work around this? I'm thinking there might be a filter for "DEWorkspace", but haven't managed to figure out how that works.

2

In a Python toolbox, you can set a list of datatypes for a parameter:

def getParameterInfo(self):
  par0 = arcpy.Parameter(
    displayName = 'Parameter 1',
    name = 'par0',
    datatype = ['DEWorkspace', 'DEFeatureDataset'],
    parameterType = 'required',
    direction = 'input')
  • That actually results in a free-for-all data type that accepts any input, and not just a workspace or feature dataset. I no longer need this functionality in my script, but thank you for your feedback. – saoirse Jun 12 '18 at 20:43
  • No problem. I have used this exact list to filter input types and it works great. Mind sharing your code? – Ian Yau Jun 13 '18 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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