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
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;
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;