Help with calculations in a matrix table | XM Community
Skip to main content

I am using Qualtrics to create an order form and was able to find a thread on calculations in a text entry matrix table using JS. Is there a way to add a totals line/statement to that or can I add another question and pull the totals from the previous question down to it to create like an “order review”? 

Here is the JS that I found that works to calculate price totals.

Paste the following code in the js(OnReady) of the matrix question

jQuery("#"+this.questionId+" td.c5 inputitype='text']").attr("readonly",true);
var p=a15,15,15,15,7,7,7,7,20];
jQuery("inputitype='text']").each(function()
{
jQuery(this).blur(function()
{
var id = jQuery(this).prop('id');
if(jQuery("eid='"+id+"']").parent().prop('className').split(" ")(0]=="c4")
{
var s=jQuery("eid='"+id+"']").val();
var i=jQuery("eid='"+id+"']").closest(".ChoiceRow").index();
var a=s*pai] | 0;
jQuery("eid='"+id+"']").closest(".ChoiceRow").find("td.c5 inputitype='text']").val(a);
}
});
});

@tcwvu526 - You might be interested in the orderFormMatrix function.


Thank you @TomG

 


Leave a Reply