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

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

  • 25 January 2020
  • 8 replies
  • 316 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!!
icon

Best answer by TomG 25 January 2020, 22:27

View original

8 replies

Userlevel 7
Badge +27
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.

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

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

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?

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}
Userlevel 7
Badge +27
> @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.
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.
Userlevel 7
Badge +27
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.

Leave a Reply