How to test condition that two embedded variables are equal? | XM Community
Skip to main content
If I have `embedded_var_a` and `embedded_var_b`, is there a way to display a question only if `embedded_var_a` == `embedded_var_b`?



Or along the same lines, can I display a question only if the respondent's answers to `question_a` and `question_b` were the same?
hey @epeterson - What is the type of question that you are using for the 2 questions whose answers you want to compare? Are they a limited set of options that you are looking to compare Qa's answers with Qb's answers?
@Igee



Unfortunately it's pretty complicated – both questions randomly display 2 companies that the respondent is familiar with. Here's a simple example:



1. Which of the following companies have you heard of?

* companyA

* companyB

* companyC

* companyD



2. Which of the following companies do you prefer?

* companyB _(randomly chosen out of their answers to #1)_

* companyD _(randomly chosen out of their answers to #1)_



3. Which of the following companies do you use the most?

* companyB _(randomly chosen out of their answers to #1)_

* companyD _(randomly chosen out of their answers to #1)_



Then we want to display the next question only if their answer to #2 was the same as their answer to #3.



Does that make sense? I realize this is probably unnecessarily complicated, so we will push back on the client if there's no clean way to do this.
@epeterson - This should be possible by using:



1. Carry Choices Forward option for Questions 2 and 3.

2. Use a Randomization for displaying the number of options (eg - 2 or 3 options).

3. Use Display logic to compare Question 2's answer with Question 3's answer, if the answer matches then only display Question 3. (you would need to add a AND / OR logic to achieve what you are looking for, but it is possible)
@Igee Yep, we have the random carry forward sorted out – but we're struggling with the display logic for the final question.



You said "Use Display logic to compare Question 2's answer with Question 3's answer" – that's exactly what I want to do, but don't see a way to do such a comparison. The 2 options are randomly chosen from a large list. Is there a way to literally specify "If `response_2` == `response_3`?" Or would we need to hard code all the possible options?
!



I figured it out – it's possible to pass piped text into the display logic.

Leave a Reply