Skip to main content
cdottie
Participant
March 22, 2018
Question

Counting Values selected from Dropdown menu

  • March 22, 2018
  • 1 reply
  • 291 views

I need a little help. I am terrible with JavaScript on a good day.

I have a form used to audit project compliance. I've been manually counting the number of Findings on each audit. I assume there must be a way to have Adobe complete this task for me. All of the drop downs affected by this script are named "Finding." 1-14. I need to count all instances where there is a finding, omitting the selections of "OK - No Finding" or "Select" displaying the summed value in the "Count" field. TIA!

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
March 22, 2018

Yes, this can be done using a script. Enter this code as the custom calculation script of the "Count" field:

var total = 0;

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

    var f = this.getField("Finding."+i);

    if (f.valueAsString!="Select" && f.valueAsString!="OK - No Finding") total++;

}

event.value = total;