Skip to main content
Participant
5월 11, 2020 2:38 오후 UTC
해결됨

Count Total Number of Check Boxes

How do I get a total number of check boxes?

 

They are named:

Check Box 1.0 - 1.9

Check Box 2.0 - 2.9

Check Box 3.0 - 3.9

Check Box 4.0 - 4.9

Check Box 5.0 - 5.9

이 주제는 답변이 닫혔습니다.
try67
try67답변
Community Expert
5월 11, 2020 3:07 오후 UTC

In that case you can use this code as the custom calculation script of the field where you want to show the result:

 

var total = 0;
for (var i=1; i<=5; i++) {
	var fields = this.getField("Check Box "+i).getArray();
	for (var j in fields) {
		if (fields[j].valueAsString!="Off") total++;
	}
}
event.value = total;

5 답변

try67
Community Expert
Community Expert
5월 11, 2020 2:54 오후 UTC

I'm assuming you mean the ticked check-boxes... If not, the answer is 50.

번역
Participant
5월 11, 2020 2:56 오후 UTC

Yes, total number of ticked check-boxes.  Thank you 🙂

번역
try67
Community Expert
try67Community Expert답변
Community Expert
5월 11, 2020 3:07 오후 UTC

In that case you can use this code as the custom calculation script of the field where you want to show the result:

 

var total = 0;
for (var i=1; i<=5; i++) {
	var fields = this.getField("Check Box "+i).getArray();
	for (var j in fields) {
		if (fields[j].valueAsString!="Off") total++;
	}
}
event.value = total;
번역