Sum up fields in a matrix table | XM Community
Solved

Sum up fields in a matrix table

  • 30 October 2019
  • 1 reply
  • 29 views

Badge +2
I want to auto calculate some fields from the matrix table below:
!

I know the only way to do this would be by using JavaScript so I tried the below but it is not working:

function setQuestionString(number, str){
var question = document.getElementById("QR~QID" + number);

question.value = str;
}

var registration_total = "${q://QID9/ChoiceTextEntryValue/1/1}";
var reg_total = parseInt(registration_total, 10);
var registration_a = "${q://QID9/ChoiceTextEntryValue/1/2}";
var a = parseInt(registration_a, 10);
var registration_b = "${q://QID9/ChoiceTextEntryValue/1/3}";
var b = parseInt(registration_b, 10);
var registration_c = "${q://QID9/ChoiceTextEntryValue/1/4}";
var c = parseInt(registration_c, 10);
var i= 0;

reg_total = a + b + c;

registration_total = reg_total.toString();
while (i<12){
setQuestionString(9, "registration_total");
}
icon

Best answer by cflasrado18 30 October 2019, 21:33

View original

1 reply

Badge +2
OK I just discovered the constant sum matrix table.

Leave a Reply