Setting multiple choices based on Embedded Data | XM Community
Skip to main content

Is it possible to take a Text Set from the embedded data (via contacts) and populate several choices based on that data? For example, let's say a piece of Embedded Data is a set:
favoritePies: Apple, Pumpkin, Cherry
and another respondent has
favoritePies: Banana, Rhubarb, Peach
Then I present a multiple-choice question that populates options from these text sets, so each respondent see different options.
When I try to pipe text like this:
${e://Field/favoritePies}
The choice shows one choice with a comma separated list of all pies for that person. I feel like there needs to be a loop or some string split to create multiple options for each person.
Thanks in advance.

Hi jeremy000,
you would need to split the embedded data field first using JavaScript
in the onload function you would have something like
favouritePies = ${e://Field/favoritePies}.split(',')
then you would need to do something to change the innerText of the answer categories
However, there are a few caveats here: you would have the original text of the categories in the data and most likely it would be quite an effort to identify the actual content.
I would suggest to have the answer categories predefined and then hide the categories which are not in the embedded data field.
The essential question is: where do you get the embedded data set from?
Best regards

Rudi









I agree with Rudi for easier analysis you will want a list of the pies so that response code option 1 always equals say "apple" for everyone instead of being "apple" for respondent X and "banana" for respondent Y.
If you can create this list from an export of your contacts, you can use the "contains" feature in display logic to show or hide each flavor in your punch list dependent on if the flavor is in your embedded variable. You can check "ignore case" to be safe about capitalization.


Thank you both. This sounds straightforward. It's actually for an academic unit (not pies, I know). I want to send a survey to large number of faculty/instructors and to survey just the courses they are teaching. I already have a spreadsheet with all of the courses they teach. I think it would streamline things if I uploaded the courses as embedded data in their contact list. I ran a test, and I'm able to do this pretty easily, but it's serializing the data into multiple choices is the part I'm struggling with. I'm seeing now how capable JavaScript/jQuery is to modify the question in the DOM. I just wanted to make sure there wasn't a built-in feature that supported this. That the "contains" feature sounds like a possible route to go.
Many thanks!


jeremy000 in this case, my recommendation changes. With a large number of faculty/instructors I doubt you will have too much overlap in courses? It seems like you actually will get more value out of the answers at an individual level and not by aggregating all answers for Course 101, Course 102, Course 103? (I could be wrong and you may have plenty of sections to make that worthwhile).
If you are interested at the person level and not at aggregating by course you can simply add as many CourseA, CourseB, CourseC... variables as you need in your contact list. Pipe all of these into your multiple choice question and add display logic for "Not empty". You probably then have follow up questions you can use the Loop & Merge feature for.
I'd strongly assess if you want to do analysis in Qualtrics or another platform like SPSS. If you are strong in SPSS then you may consider writing code there to aggregate data by course and leaving your Qualtrics set up more simple like suggested in this post and not my last post. Test a small data file to see how it saves information, specifically how the data file shows you...

  • the course value saved in each variable

  • the value it returns when selected in the multiple choice question

  • set up of columns and display of variables asked about if you end up with a case for using loop and merge


@bstrahin Can you walk me through your response a bit more? I have been looking for a way to do this and am coming up confused on the method you present (specifically the add display logic for not empty) part.


Leave a Reply