Checkboxes question

Hi! I am wanting to make a survey where the students will check only boxes that apply to themselves and then add up the number of boxes. I want to see if there is a code for count the number of boxes that are checked.

1 Like

Coding for multi-select can be pretty tough because you have to account for all the combinations of items that could be selected. Do you think the statements could be placed in a table and then the student could place an X in an adjacent column? Coding for that would be a little easier. I can provide an example if you are interested.

I got it figured out. I did this:
a1=when B1_1.isSelected(1)1 otherwise 0
a2=when B1_1.isSelected(2)1 otherwise 0
a3=when B1_1.isSelected(3)1 otherwise 0
a4=when B1_1.isSelected(4)1 otherwise 0
a5=when B1_1.isSelected(5)1 otherwise 0
a6=when B1_1.isSelected(6)1 otherwise 0
a7=when B1_1.isSelected(7)1 otherwise 0
a8=when B1_2.isSelected(1)1 otherwise 0
a9=when B1_2.isSelected(2)1 otherwise 0
a10=when B1_2.isSelected(3)1 otherwise 0
a11=when B1_2.isSelected(4)1 otherwise 0
a12=when B1_2.isSelected(5)1 otherwise 0
a13=when B1_3.isSelected(1)1 otherwise 0
a14=when B1_3.isSelected(2)1 otherwise 0
a15=when B1_3.isSelected(3)1 otherwise 0
a16=when B1_3.isSelected(4)1 otherwise 0
a17=when B1_3.isSelected(5)1 otherwise 0

clus1total=numericValue("{a1}+{a2}+{a3}+{a4}+{a5}+{a6}+{a7}+{a8}+{a9}+{a10}+{a11}+{a12}+{a13}+{a14}+{a15}+{a16}+${a17}")

I don’t know why I didn’t think that would work for multi-select. I know I’ve tried using multi-select to display options that were selected on another screen so students could explain their reasoning, and I think that’s where you need all the combinations. Maybe I’m mistaken on that too. Good job figuring it out!

I wish I could take the credit, a nice person on the facebook group helped me!

You’re welcome. I saw it here too, and figured you’d get to it. :smiley:

When typing your code into the forum, use triple backticks on the line before and after your code, and it will display nicely (and not delete out certain characters).

1 Like