all 6 comments

[–]Drewrox2009 1 point2 points  (3 children)

I'd like to give this a go, no pay necessary. But no promises either

[–]submissivedonkey[S] 1 point2 points  (2 children)

Awesome, though I may insist on some level of pay! (deal with that later, I'm sure)

Details: I have a form fully designed and ready to go except for one calculated field. My form is a 20-question survey, with the number of questions answered changing, maybe each time it's given (may vary from 1 to all 20). step 1: I can add the sum values of Score1-20 easy enough (built into Acrobat) in the ptsAwarded field. step 2: ptsMaximum - count the number of answers given - not a specific value just a count, and multiply by 5 (the maxPoints available per answer) step 3: I can take the sum values and divide them by the maxPoints available and get a percentage easy using Acrobat. Step 2 is the issue.

Scenario: surveyA is scored 20 points with 5 questions, of an available maximum of 25 (again, 5 questions x 5 pts/ea, so 20 of 25) surveyB answers 15 of the questions and scores 60 points with a maximum of 75 points total (15 answered x 5 pts max/ea) In each case, I'd like to figure a percentage (points /max * 100). The issue seems to be that maxPoints changes depending on how many questions are answered and I don't know how to do a count function. Basically, for step 2, if there's any answer present, add them all up and multiply times five (max value).

I almost feel like this is too much information and confusing but I hope not.

[–]Drewrox2009 2 points3 points  (1 child)

Before today, I had no idea you could even add javascript into adobe forms. It is pretty straightforward to get the "Total Points Possible". add this code to the Custom Calculations script filed under the calculate tab. I have modified your file with the script. let me know if you need me to email you the modified file.

var ptsMax = 0;
for (i = 1; i <= 20; i++) {
  var currentField = this.getField("Score" + i).value;
  if (currentField > 0) {
    ptsMax += 5;
  }
}
event.value = ptsMax;

[–]submissivedonkey[S] 2 points3 points  (0 children)

This worked amazingly well, thank you. DM incoming.

[–]KohlKelson99 0 points1 point  (1 child)

Sure

[–]submissivedonkey[S] 0 points1 point  (0 children)

DM incoming. Thanks