• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
13

Count number of times values selected in a dropdown.

Community Beginner ,
Mar 08, 2024 Mar 08, 2024

Copy link to clipboard

Copied

Hello, 
First timer here, trying to automate an incident sheet for our fire co.
I'm trying to create scripts to count the number of members who responded on a certain vehicle.
We have a list of 40 people and there is a drop down next to their name. the dropdown has the vehicles list. 
EX: if we have 6 members respond on 52-12 , I would like the script to count the number of times 52-12 was selected in the drop-down and populate that on another field for a total. Simplifying things for the guys. 

Dave35953053a65j_0-1709921539083.png

Dave35953053a65j_1-1709921595383.png

 

 

TOPICS
JavaScript , PDF forms

Views

198

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 08, 2024 Mar 08, 2024

Copy link to clipboard

Copied

Dave35953053a65j_0-1709921802079.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 08, 2024 Mar 08, 2024

Copy link to clipboard

Copied

What are the names of the dropdown fields?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 08, 2024 Mar 08, 2024

Copy link to clipboard

Copied

the drop downs are labeled as the person's name (Last,First).  the spare at the end are "2" through "10"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 08, 2024 Mar 08, 2024

Copy link to clipboard

Copied

Dave35953053a65j_0-1709927590085.png

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 08, 2024 Mar 08, 2024

Copy link to clipboard

Copied

LATEST

You can use something like this code as the custom calculation script of the text field where you want to show the count of the "5212" values, for example:

 

var dropdowns = ["Yob, Jordan", "Doe, John"]; // etc.
var total = 0;
for (var i in dropdowns) {
	if (this.getField(dropdowns[i]).valueAsString=="5212v1") total++;
}
event.value = total;

 

Fill in the first line with the actual field names, and notice that the value used in the script is the export value, not the display one.

Votes

Translate

Translate

Report

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