Get selected items from checkbox form
Hello. I have create an workflow with checkbox populated from an query and get and set From Elements ID. I want to implement an change event then user activate one checkbox. I'm able to get the last selected item with the getFormEventData.value. But I need to get all selected item in the form and populate an new query based on the selected values from all selected checkbox in the form. How can this be done?
-
I assume you're working with the Check Group form item rather than invididual Check Box items, since you mentioned it's populated from a query, but let me know if that's not the case.
With the Check Group form item, you can get the state of each checkbox like this:
$form1.state.checkGroup1.items[0].checked
$form1.state.checkGroup1.items[1].checked
etc.
If you want to grab values from all the boxes in a checkgroup at once, you could do something like this:
- use Create Value to make a value that will hold your checked items
- add a For Each activity to loop through each item in the check group
- Inside the For Each, use an If activity to see if the individual checkboxed is checked or unchecked.
- If it's checked, add it to the value from step 1
- After the For Each activity, do something with that filled in list of checked items (eg, run a new query)
Example here: https://latitudegeo.maps.arcgis.com/home/item.html?id=e00e0da0d9fc45369bdae21b5835aa88
1 -
Thank you for this example, Amanda! This was exactly what I needed :)
0 -
@Amanda Frech? why can't I access this sample? thx.
0 -
@Eric Kriener? Try signing into workflow designer using your normal bookmark/url. Then use File > Open by Url, and paste the URL.
Not all users can open workflows by clicking the launch button from the ArcGIS Online page, because some organizations have access to the on-prem version of workflow instead of the cloud apps.geocortex.com version.
I should also mention that this post is a couple years old, and newer versions of workflow have a built-in property that returns just the "checked" items from a checkgroup. So if you use =$form1.state.checkGroup1.value.items as the input on the ForEach activity instead of =$form1.state.checkGroup1.items, you can safely remove the "If" activity inside the ForEach.
0 -
awesome. I got in to it and I'll check it out. thanks for the new tip as well!
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
5 Kommentare