Highlighted

## Counting checkbox export value

New Here ,
Nov 05, 2020

Copied

Hi,

I have a form with 15 questions, for each question, there are 3 answers (A, B, and C). at the end of the form, there is a table for the results (A, B, and C).

I need to count the number of selections for each one (example: A: 7, B: 3, C: 5). I set the export value for A answers as "A" and so on..

I tried to search for a solution but couldn't find anything.

Thanks

Most Valuable Participant
| Most Valuable Participant

You can use this code to count the number of instances "A" was selected, and with minor adjustments the rest of them:

var total = 0;

for (var i=1; i<=15; i++) {

if (this.getField("Check Box"+i).valueAsString=="A") total++;

}

event.value = total;

TOPICS
PDF forms

Views

133

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

## Counting checkbox export value

New Here ,
Nov 05, 2020

Copied

Hi,

I have a form with 15 questions, for each question, there are 3 answers (A, B, and C). at the end of the form, there is a table for the results (A, B, and C).

I need to count the number of selections for each one (example: A: 7, B: 3, C: 5). I set the export value for A answers as "A" and so on..

I tried to search for a solution but couldn't find anything.

Thanks

Most Valuable Participant
| Most Valuable Participant

You can use this code to count the number of instances "A" was selected, and with minor adjustments the rest of them:

var total = 0;

for (var i=1; i<=15; i++) {

if (this.getField("Check Box"+i).valueAsString=="A") total++;

}

event.value = total;

TOPICS
PDF forms

Views

134

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 05, 2020 0
7 Replies 7
Most Valuable Participant ,
Nov 06, 2020

Copied

What are the names of the fields?

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 06, 2020 0
New Here ,
Nov 06, 2020

Copied

Check Box1
Check Box2
Check Box3
Till
Check Box15

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 06, 2020 0
Nov 06, 2020

Copied

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 06, 2020 0
New Here ,
Nov 07, 2020

Copied

That's a different scenario, in your reply, the final calculation is the result of all selections as one sum.

In my case, I need to know how many A, B, and C. Therefore, there are 3 calculators, one to count A, one to count B and one to count C

Refer to this example https://www.dropbox.com/s/jv3axw68zkwgr7p/Example.pdf?dl=0

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 07, 2020 0
Most Valuable Participant ,
Nov 07, 2020

Copied

You can use this code to count the number of instances "A" was selected, and with minor adjustments the rest of them:

var total = 0;

for (var i=1; i<=15; i++) {

if (this.getField("Check Box"+i).valueAsString=="A") total++;

}

event.value = total;

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 07, 2020 1
New Here ,
Nov 07, 2020

Copied

Thanks,

It's working.  -:)

Unfortunately, it looks that the built-in PDF viewers on Edge and Chrome don't support that sort of thing...

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 07, 2020 0
LATEST
Nov 07, 2020

Copied

"Unfortunately, it looks that the built-in PDF viewers on Edge and Chrome don't support that sort of thing..."

All PDF form makers should know this great trick: