Sum up fields in a matrix table | XM Community
Skip to main content
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");

}
OK I just discovered the constant sum matrix table.

Leave a Reply