Summarize several matrix questions | XM Community
Solved

Summarize several matrix questions

  • 16 May 2022
  • 1 reply
  • 9 views

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

icon

Best answer by bgooldfed 17 May 2022, 08:39

View original

1 reply

Userlevel 5
Badge +25

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