Is there a way to use Embedded Data with In-page Display Logic (or similar work-around)? | XM Community
Solved

Is there a way to use Embedded Data with In-page Display Logic (or similar work-around)?

  • 13 April 2018
  • 6 replies
  • 166 views

Userlevel 7
Badge +30
  • Level 6 ●●●●●●
  • 1047 replies
I have a page in a survey with four questions. The first three questions apply to all respondents, but the fourth question does not apply to members of specific groups (who are identifiable in the Embedded Data), so I want to hide it from those respondents.

The catch is that I'd prefer the fourth question to stay on the same page as the first three, not be on a page by itself. This requires that I use the In-page option in Display Logic, but that only works with questions, not embedded data. I thought I could work around that by piping the Embedded Data to a text question on this page that I used Display Logic to always hide (because I don't want to run the risk of a curious respondent modifying the piped values), but I have learned the hard way that piping only works when the target question is visible.

Is there some clever way to make this happen that I'm not seeing?
icon

Best answer by MohammedAli_Rajapkar 17 April 2018, 01:23

View original

6 replies

Userlevel 7
Badge +20
Hi @MatthewM,

Is there a "descriptive text" or any page shown before this 4 questions page? If yes, then you can have a hidden "text question" on any previous page and capture the embedded data value into that "text question" and then use the value of that "text question" to apply in page display logic.

You would have to find out the question id for that "text question" by using inspect feature and then add the code in the onload section of JavaScript:

jQuery("#id_of_Question_to_hide").css("display","none")
Userlevel 7
Badge +27
An easier way to hide a question with JavaScript (no need to look up an id) is:
```
jQuery("#"+this.questionId).hide();
```
Badge +1

Thank you for this solution! This works great!!

Badge +1

While adding the Javascript to the question to hide it worked, it left me with an unintended consequence. There is a line for each question that's hidden. I can convince my survey requestor to ignore these lines (5 lines from 5 hidden questions), but was wondering if anyone knows of a way to get rid of them? Thank you!!
image.png

Userlevel 7
Badge +27

Add this to the JS of each hidden question:
Qualtrics.SurveyEngine.addOnReady(function() {
jQuery("#"+this.questionId).next(".Separator").hide();
});

Badge +1

Thank you so much, Tom!!!

Leave a Reply