Customize display of previous selected choice(s)? | XM Community
Solved

Customize display of previous selected choice(s)?

  • 21 April 2021
  • 3 replies
  • 188 views

I have some multiple choice questions and would like to show participants their own choices after the questions.

I noticed that this can be done with piped text. However, I wonder if we can customize the display of slected choice. For example, the question can have 10 options, each of which is somehow wordy, and instead of showing all the options people chose, we only displayed something like "option 1, option 5, option 7, option 9" etc.

I found an ugly solution to this by using branch if in survey flow. But for some reason I want the question page and the display page in the same block so I can't insert branch if in between them.

Does anyone have any suggestions on how to achieve this?

icon

Best answer by GrumpyCivet 22 April 2021, 08:20

View original

3 replies

Userlevel 3
Badge +8

You can recode the values of the selected responses and have that piped to display or you can use javascript to set embedded data variable to whatever you want and then display the embedded data.

pogi Thank you for your response!
Recoding values does not work since it only allows entering number instead of text like "option 1".
Could you please elaborate on how to set embedded data conditional on which option(s) are chosen using javascript? I only know limited javascript and its application on Qualtrics - can't think of how we can actually do this now.

I figure out:
var currentQuestionID = this.getQuestionInfo().QuestionID;
var questionObject  = Qualtrics.SurveyEngine.getInstance(currentQuestionID);

const translate = {
1: " option 1",
2: " option 2",
3: " option 3",
4: " option 4"
};

this.questionclick = function(event,element){
if (element.type == 'checkbox') {
var selectedChoices  = questionObject.getSelectedChoices();
selectedChoices = selectedChoices.map(myChoice => {
return translate[myChoice]
})

Qualtrics.SurveyEngine.setEmbeddedData("selectedChoices", selectedChoices);
}
};
Then just insert the embedded data

selectedChoices
as piped text.

Leave a Reply