0
New Here
,
/t5/acrobat-sdk-discussions/sum-the-values-in-one-text-box-from-another-set-of-text-boxes-based-on-checkbox-selection/td-p/13784360
May 10, 2023
May 10, 2023
Copy link to clipboard
Copied
I am trying to sum the values in one text box from another set of text boxes if the corresponding checkbox is selected.
I would like Text 100 to be the sum of any value in Text 360, Text 367, Text 374 and/or Text 381 if the corresponding checkbox is selected. The corresponding checkboxes are
Text 360 would be linked to Check Box 27
Text 367 would be linked to Check Box 29
Text 374 would be linked to Check Box 31
Text 381 would be linked to Check Box 33
TOPICS
Windows
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Community Expert
,
May 18, 2023
May 18, 2023
Use this as 'Custom calculation script' of "Text 100":
var total = 0;
var cText = ["Text 360","Text 367","Text 374","Text 381"];
var cCheck = ["Check Box 27","Check Box 29","Check Box 31","Check Box 33"];
for(var i in cCheck){
if(this.getField(cCheck[i]).valueAsString != "Off")
total += Number(this.getField(cText[i]).valueAsString);}
event.value = total;
Community Expert
,
LATEST
/t5/acrobat-sdk-discussions/sum-the-values-in-one-text-box-from-another-set-of-text-boxes-based-on-checkbox-selection/m-p/13801912#M91573
May 18, 2023
May 18, 2023
Copy link to clipboard
Copied
Use this as 'Custom calculation script' of "Text 100":
var total = 0;
var cText = ["Text 360","Text 367","Text 374","Text 381"];
var cCheck = ["Check Box 27","Check Box 29","Check Box 31","Check Box 33"];
for(var i in cCheck){
if(this.getField(cCheck[i]).valueAsString != "Off")
total += Number(this.getField(cText[i]).valueAsString);}
event.value = total;
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

