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

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

  • Jan 25, 2020 6:40 PM UTC
  • 8 replies
  • 790 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.
View original

8 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • Jan 25, 2020 9:27 PM UTC
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
  • Jan 25, 2020 9:53 PM UTC

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


  • Author
  • Jan 25, 2020 9:53 PM UTC

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


  • Author
  • Jan 25, 2020 11:51 PM UTC

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
  • Jan 26, 2020 12:23 AM UTC
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 ●●●●●●●●
  • Jan 26, 2020 6:27 PM UTC
> @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
  • Feb 5, 2020 4:48 PM UTC
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 ●●●●●●●●
  • Feb 5, 2020 7:53 PM UTC
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.