Mulitvalue string parameter with drop-down list in Python Script Tool

344
3
03-31-2013 12:02 PM
New Contributor III
I am trying to build a script tool using ArcGIS's 10.0 built-in python functionality. I have been trying to create a multiple value string parameter with a pre-determined set of values that each of the multiple values can take. For instance, I might give the user a value list including ['up', 'down', 'left', 'right'] and then in the tool dialog the user should be able to choose from that list multiple times, with repeats. For instance, the user might choose ['up', 'up', 'left'] as three separate inputs.

I cannot seem to get this to work. I do not want what ArcGIS considers a "MultiValue" "String" with a "Value List" filter. This only allows the user to select multiple values in the value list, without repeats.

Alternatively, I cannot get a satisfactory result when I create a "MultiValue" "String" with no filter. In this case, the user is completely unable to add to or remove values from the list (because, for some reason, the "Add Value" button is always disabled). How does that make any sense?

A third option, which I consider a huge failure if I have to resort to it, is to create two parameters, where the first parameter is a non-multivalue dropdown list and the second parameter is a multi-value string that successively appends choices from the first parameter to its values.

Is there a simple way to achieve what I am asking?
Tags (2)
Reply
0 Kudos
3 Replies
MVP Esteemed Contributor
I think the third option is a very creative solution that would be pretty easy to implement using parameter validation code.
Reply
0 Kudos
New Contributor III
The third option is not ideal because it forces me to send an extra parameter to the executing script that is ignored. That also implies that if the script were called from the command line, the user would have to do the same thing (unless I also added some code that recognizes command-line vs arcmap).

Also, I attempted to implement the third option briefly yesterday and was unable to get it to work. I am not sure if it is because what I want is impossible or I just was doing something wrong.
Reply
0 Kudos
New Contributor III

This bug is still not fixed in 10.7.  I haven't tried it in Pro yet.

Reply
0 Kudos