How to add comma separated 'or' values for Embedded Data in the display logic condition field? | XM Community
Skip to main content

Earlier in my survey I capture prolific participant IDs, and I already know which of those were in a previous study's control and intervention group.
I want to selectively display a question ONLY to the IDs of those participants in the intervention group from the prior study.

However, it looks like I might need to add a new row for every single value I want the question to be displayed for (see attached screenshot
Capture.PNG)

Is it possible to paste in comma-separated IDs so that the condition is Embedded data = prolific ID = contains value1, or value 2, or value 3, or value 4 etc etc?

Thanks!

In display logic you will have to add the new row for new value, instead this you can directly add the specific conditions in the survey flow itself and set the embedded variable to true.
Or
You can write some JS code before the question which needs to be shown based on the PROLIFIC_PID and add the base logic as PROLIFIC_PID_flag equal to true (or any other value whichever you want), JS can be like,
var prolific_pidArr = [1,2,3,4,5]
var prolific_pid = "${e://Field/PROLIFIC_PID}"
for(var i=0;i{
if(prolific_pid == prolific_pidArr[i])
{
Qualtrics.SurveyEngine.setEmbeddedData('PROLIFIC_PID_flag','true')
}
else
{
Qualtrics.SurveyEngine.setEmbeddedData('PROLIFIC_PID_flag','')
}
}


You can set the display logic to match regex and then list your words in regular expression. This is an example and here is a link to a website to help if you are unfamiliar with regex!
PROLIFIC_PID -> Matches Regex -> \\bTHING|\\bITEM|\\bFOO
So here the question would display if the embedded field was equal to thing, item, or foo


Thank you so much for your help, that is really useful!


Leave a Reply