Summarize several matrix questions | XM Community
Skip to main content

Hi there!
I have a matrix question with 5 items and I just want to create some kind of index out of the 6 statements but it does not work. Not even this simple version (later it will be more complex but not even this "easy" version is working).
It should not be that hard but I just don't get it :(
Already tried many variations...

var brandindex= "";
brandindex=
("${q://QID122_1//SelectedAnswer/Recode/1}"-1)+
("${q://QID122_2//SelectedAnswer/Recode/2}"-1)+
("${q://QID122_3//SelectedAnswer/Recode/3}"-1)+
("${q://QID122_4//SelectedAnswer/Recode/4}"-1)+
("${q://QID122_5//SelectedAnswer/Recode/5}"-1)+
("${q://QID122_6//SelectedAnswer/Recode/6}"-1)
Qualtrics.SurveyEngin/ChoiceNumericEntryValuee.setEmbeddedData( "brandindex", brandindex);
The result is -6, so it ignores the Variables
Thank you for your support!!!
Cheers,
Jessi Laoson

Hi Lusamai ,
I believe you have some typos in your code. Your piped text fields seem to be using too many forward slashes. If you want to make sure you're using the correct format, try inserting some of the piped text in another part of your survey.
image.png
Here is an example I used on a matrix question with QID5 that worked fine:
var brandindex = "";
brandindex = ("${q://QID5/SelectedAnswerRecode/1}"-1) + 
("${q://QID5/SelectedAnswerRecode/2}"-1) +
("${q://QID5/SelectedAnswerRecode/3}"-1);

console.log(brandindex); // answer in console was printing correctly based on user choice

You also have some typos in this line (SurveyEngine and EntryValue):
Qualtrics.SurveyEngin/ChoiceNumericEntryValuee.setEmbeddedData( "brandindex", brandindex);

Best of luck!


Leave a Reply