How to create display logic based on previous responses being same/different | XM Community
Skip to main content
Solved

How to create display logic based on previous responses being same/different

  • January 25, 2020
  • 8 replies
  • 678 views

I need to construct the following display logic, but I am unsure on the best way to do it. If you have any suggestions please advise, thanks! For example, i need to create a survey that follows the following rule: Question 1 (multiple choice, single answer) Question 2 (multiple choice, single answer) **Question 3 (display logic, only show Q3 if Q1 response = Q2 response, if not, skip to Q4). Question 4 (multiple choice single answer) Thanks!!

Best answer by TomG

In survey flow, set an embedded variable (Q1recode) to the piped selected choice recode of Q1. In display logic for Q3, check if Q1recode = pipe selected choice recode of Q2.

8 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6083 replies
  • Answer
  • January 25, 2020
In survey flow, set an embedded variable (Q1recode) to the piped selected choice recode of Q1. In display logic for Q3, check if Q1recode = pipe selected choice recode of Q2.

  • Author
  • 5 replies
  • January 25, 2020

how do I set the embedded variable, should I use JavaScript for the question? Could you provide a suggestion ?


  • Author
  • 5 replies
  • January 25, 2020

Ah I see. My mistake. U said survey flow. Ok I’ll try that thanks!


  • Author
  • 5 replies
  • January 25, 2020

So if I understand correctly, each group of questions will need to be in its own block correct? I have 16 of these question groups. Do they all need their own block?


  • Author
  • 5 replies
  • January 26, 2020
here is what i tried, but it doesnt seem to work -- any suggestions? show Q131 if: ${q://QID129/SelectedChoicesRecode} is equal to ${q://QID129/SelectedChoicesRecode}

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6083 replies
  • January 26, 2020
> @cs2388 said: > here is what i tried, but it doesnt seem to work -- any suggestions? > > show Q131 if: > > ${q://QID129/SelectedChoicesRecode} is equal to ${q://QID129/SelectedChoicesRecode} The left side of the comparison has to be an embedded data field. Follow the instructions in my first post.

  • Author
  • 5 replies
  • February 5, 2020
Tom, using your method i will be forced to create many dozens of new blocks. is there a way to set embedded data using javascript in the question itself instead of in survey flow? thank you for your help.

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6083 replies
  • February 5, 2020
Yes, use the function: ``` Qualtrics.SurveyEngine.setEmbeddedData("edName", "edValue"); ``` If you want the embedded data (i.e., edName) saved in your response data, you have to create it in the survey flow prior to the block where you set it in the JavaScript. The value (i.e., edValue) can be piped from questions on PREVIOUS pages.