recode value in Matrix question | XM Community
Skip to main content

Hi!
I want to a create a variable based on responses to a set of statements in a matrix table. I am trying to do this by using the following. But this does not work. Anyone know of a different way? For example, using this.getChoiceRecodeValue(this.getSelectedChoices()); syntax? I don't know how to modify this for the matrix table.. thanks for any help!
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var paydec = "${q://QID94/SelectedAnswerRecode/3}";
if (paydec==="1"){
part2pay = 1.00;
}
else {
part2pay=0.40;
}

Qualtrics.SurveyEngine.setEmbeddedData("part2pay", part2pay);

Use the below code:
This code checks if row choice 3 and answer col 2 is selected then if condition is true. Similarly you can change the row and column number and add logic accordingly.
Qualtrics.SurveyEngine.addOnPageSubmit(function(type)
{
if(type == "next")
{
var part2pay;
if(this.getChoiceValue(3,2)){


part2pay = 1.00;
}
else {
part2pay=0.40;
}
Qualtrics.SurveyEngine.setEmbeddedData("part2pay", part2pay);


}
});


Thanks so much! This works perfectly!


Leave a Reply