When a Parameter holds multiple values, it would be nice to be able to catch them in a simple list object instead of a String or ValueTable.
For example, given:
param0 = arcpy.Parameter(
displayName="Inputs",
name="inputs",
datatype="GPString",
parameterType="Required",
direction="Input",
multiValue=True)
If the user inputs multiple strings like "Orange", "Apple", "Banana" the current options are
parameters[0].valueAsText # "Orange;Apple;Banana"
or
parameters[0].value # <geoprocessing value table object>
I would like to be able to return multiple values in a more idiomatic way:
parameters[0].value # yields simple list: ["Orange", "Apple", "Banana"]
Yes, it is easy to do parameters[0].valueAsText.split(";") or search through a value table, but both approaches are a needless complication. Getting a list directly from the Parameter seems to be the most straightforward, intuitive way to deal with multiple values.
To flesh this out more, there ought to be a .valueAsTable property for when one wants to return the ValueTable object:
parameters[0].valueAsTable # returns ValueTable
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.