Skip to main content
Participant
Dec 12, 2016 11:15 PM UTC
Answered

Count evaluations

I have an acrobat form with 10 questions that people can evaluate using one of 4 radios (0-1-2-3). I want to count how many of the questions score 2 or greater and put that in the 'TOTAL'.

ie.

1. 1

2. 2

3. 0

4. 3

5. 3

6. 3

7. 2

8. 1

9. 2

10. 3

TOTAL = 7

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Dec 13, 2016 9:41 AM UTC

Let's say the fields are called Q1, Q2, ..., Q10. You can use this code as the custom calculation script of the Total field:

var total = 0;

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

    if (Number(this.getField("Q"+i).valueAsString)>=2) total++;

}

event.value = total;

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Dec 13, 2016 9:41 AM UTC

Let's say the fields are called Q1, Q2, ..., Q10. You can use this code as the custom calculation script of the Total field:

var total = 0;

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

    if (Number(this.getField("Q"+i).valueAsString)>=2) total++;

}

event.value = total;

Translate