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

Sum the values in one text box from another set of text boxes based on checkbox selection.

New Here ,
May 10, 2023 May 10, 2023

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
460
Translate
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

correct answers 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;
Translate
Community Expert ,
May 18, 2023 May 18, 2023
LATEST

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