Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Help! Trying to Count Checkboxes

Avatar

Level 1

I have created a form and would like to count the number of checkboxes in each that have been selected.

However, I am not a programmer and totally confused.  I have reviewed all the information I can find on these forums relating to this.   I have also searched on line for a example I could use.  If you anyone could help me I would greatly appreciate it.

Thanks much.

7 Replies

Avatar

Level 10

Hi,

Have a look at this example and see if it helps: http://assure.ly/xDbtbx.

Niall

Avatar

Level 1

Thanks Niall,

I'll give it a try.

Penny

Avatar

Level 1

Niall,

I must be making progress in understanding how this stuff works, because I could understand your example.   However, I could not translate it for my form.  I think the problem may be the checkboxes I am wanting to count are set up as columns in a table and I need to count the checkboxes in each column.  So if you have any other suggestions I would appreciate the help.

Thanks again,

Penny 

Avatar

Level 10

Hi Penny,

Is the Table static (eg, the user cannot add additional rows) or is it dynamic (where the user can add more rows/checkboxes)?

Niall

Avatar

Level 1

Hi Niall,

The table is a static table. Thanks for your help.

Penny

Sent from my iPad

Avatar

Level 10

Hi,

Have a look at htis example that shows how to reference objects in the form. It has both JavaScript and FormCalc examples and include summing tables: http://assure.ly/kUP02y.

As you know checkboxes has a default value of 1 for on and 0 for off. If uour rows have the same name (eg Row1), then the following FormCalc in the total object would work:

$ = Sum(Table1.Row1[*].CheckBox)

This uses the wildcard to go through all of the instances of Row1. If your table or objects are named differently these will need to be reflected in the script.

If your rows are named differently then you will need to reference them one at a time. Again using FormCalc:

$ = Row1.CheckBox + Row2.CheckBox + Row3.CheckBox + Row4.CheckBox

Hope that helps,

Niall

Avatar

Level 1

Thank you...thank you! This worked.... I did not the it could be as easy as this.

You rock! I really appreciated your time and help.

Penny

Sent from my iPad