Multiple Values Parameter Behavior: Desktop vs Pro

05-07-2021 02:56 PM
Occasional Contributor III

I am updating a python tool from Desktop (python 2) to Pro (python 3). In my old tool, I scripted the validator class to make updates to some parameters based on user drive changes and choices.

One of the parameters is:

  • a string data type 
  • accepts multiple values
  • contains a filter

The list is driven from a spreadsheet in the validator class when the tool initializes:



valueList = ~iterate over the spreadsheet and compile a list~
self.params[4].filter.list = valueList
self.params[4].values = self.params[4].filter.list



The parameter in the old tool looks like this:


Where the user can toggle on or off, which items from the list they want by either selecting or deselecting the check boxes or utilize the 'Select All/Unselect All' buttons.

When the tool runs, it will process on the users choices in the list that are checked off and ignore anything that was not.

In ArcGIS Pro, the parameter behaves a little differently. First, the appearance has changed:


In the above image, the list is populated based on the same validator logic above, but does not have the check marks beside it (let's call this the main list). In order for the user to get the option to check off items from the list, they have to click on the dropdown button (highlighted yellow in the image above) which will pop out a submenu with the same list (lets call this the sub list) except here, the user can then check off the items they want.


Issues with this:

  1. First, regardless of what the user has chosen in the sub list, the tool still runs on all items from the original list.
  2. Second, the main list doesn't get updated when the user makes choices in the sub list which leads me to believe this is causing issue #1.
  3. I have sorted the list in a customized way using the validator. The main list maintains this sorting but the sub list does not. It always populates the list in alphabetical order.

It seems there is a disconnect I am missing between how these 2 lists communicate with each other in Pro.

I've tried to test when the list is altered using the 'updateParameters' function in the validator, but it doesn't seem to pick up that the list has been altered by the users choices.


Ideally, I want what I had in my Desktop tool. Basically, a pre-populated list that allows the user to choice which items that want and have the tool accept those choices and to maintain the sorting of the list I set in the validator.




0 Kudos
2 Replies
MVP Regular Contributor

Deleted original reply. Desired behaviour can be achieved with a python toolbox (.pyt) instead of a script tool in a custom toolbox (.tbx).

Occasional Contributor III

Thanks Luke. That solved the issue! These subtle changes keep throwing me for a loop but at least I am slowly getting my tool into Pro. Cheers.

0 Kudos