Select to view content in your preferred language

Add Checkboxes to Dropdown list in GP script tool

1228
4
05-25-2022 11:56 PM
RichardHowe
Frequent Contributor

I am currently adding a script to a GP tool in ArcGIS Pro and I was wondering how to recreate the functionality which (still exists) on the delete fields GP tool of having checkboxes against items that appear in a dropdown list.

I appreciate the list is dynamic for the delete fields tool based on the feature class or table that the user selects and my use case is not, but I don;t see why that should be a limiting factor. I am looking to hardcode some options into my tool for the user to select against a certain parameter. When I set it up as a multivalue string I get a dropdown that allows multiple picks it, but it adds a new row into the tool GUI every time and the user has to select all 10 options one by one...which isn't very slick. For ease of use I'd just like to enable the user to tick each option they want and have the "select all" behavior as demonstrated on the screenshot.

Any help would be much appreciated.

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

Checkboxes are boolean parameters and the select all option becomes available with multivalue.  What is your parameter type?


... sort of retired...
RichardHowe
Frequent Contributor

 

Dan,

 

Thanks for the reply. The parameter type is string. That said, the checkboxes that appear in ArcGIS Pro's "Delete Fields" tool must surely be of type "field" for it to work...and they still have checkboxes and displayed within a list, which is different to how the checkboxes behave if you set the type to boolean and pick multivalue. So there must be a way to make it work without the need for the parameter to be boolean?!

Screenshot below shows what happens if I make the parameter boolean (on the left of the black line), it also doesn't show all the options, it only populates the next row when I select one checkbox. I would like all options presented to the user all the time. Screenshot on the right shows how delete fields tool behaves and how I'd like my options to display ideally.

 

DropdownCheckbox2.png

0 Kudos
RyanDavis1
Regular Contributor

@RichardHowe, if I follow you correctly I'm doing this in a Python toolbox.  My parameter type is multivalue GPString, and I apply a ValueList type filter.  I then have a parameter.filter.list of strings for the user to choose from.

0 Kudos
RichardHowe
Frequent Contributor

@RyanDavis1 Interesting. And does it display as per my example i.e. scrollable checkboxes?

0 Kudos