Copy link to clipboard
Copied
I created a form in acrobat with several cells that will have as information the characters "C" or "D". I need to sum up how many of these cells contains "C" and how many contains "D". Already searched in several tutorials and found nothing. Is there any way to perform this calculation?
The fields have names ranging from 2cd1.1 to 02cd1.135.
The information will be: "C" or "D"
I only need to add the fields with the variable "C" and then only the fields with the variable "D", disregarding the empty fields.
Field "tcri" should display total of "c" and field "tdri" should display total of "D"
thanks for the suport
You could use this code as the custom calculation script of the field that shows the total number of "C" items:
var total = 0;
for (var i=1; i<=135; i++) {
if (this.getField("cd.1."+i).valueAsString=="C") total++;
}
event.value = total;
Copy link to clipboard
Copied
This was discussed multiple times in the past, but Adobe removed access to many old threads, unfortunately...
What are the names of these fields?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I woul fill an array with the values of the fields and then filter that array to only the values of "C" or 'D' and then take the length of the filetered array.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You could use this code as the custom calculation script of the field that shows the total number of "C" items:
var total = 0;
for (var i=1; i<=135; i++) {
if (this.getField("cd.1."+i).valueAsString=="C") total++;
}
event.value = total;