Upvote 1

Obtain count of "checked" checkboxes within a data list

Completed Josh Thomas 7 years ago

fyi...

I was unable to figure-out an expression to count number of "checked" checkboxes within a data list. So, I came-up with a work-around as noted here:


Element Setup:

1) add a column to your data list

2) add the "checkbox" element to your placeholder row of the data list (in the new column you created)

3) in the same column, add the "input text field" element (set properties to "hidden")

Build Expressions:

First Expression: create an "on change" event for the checkbox in the placeholder row of the data list

a) "set value" of the "input text field" element in the placeholder row of the data list to "fixed value" = 1

b) add condition ("When") to above "Do" command: When "checkbox" element "is Checked" (see image below)

79bb10277393e29f9d9f696c77188d15


c) add "Else": "set value" of the "input text field" element in the placeholder row of the data list to "fixed value" = 0

here is the expression overview:

62472fc5e26b59773ccdea2163cd1937


Second Expression: create a "text input field" to receive the count of checked "checkboxes"

a) using an "on change" event or "on click/tap" (for a button), build a "set value" expression that sums the values of the "text input fields" you have in your data list (1 = checked, 0 = not checked)...here is what that looks like (first element is your data list, second value is the "text input field" you added in the placeholder row of the data list:

e4baa8cd6c0c8a2039a194fc8f6980a1


--- END ---


-josh

Replies (1)
photo
1

Hi Josh,


Great workaround!


Best,

Danielle

Leave a Comment
 
Attach a file