Display Embedded Data in list view for multiple choice question | XM Community
Solved

Display Embedded Data in list view for multiple choice question

  • 17 October 2018
  • 4 replies
  • 58 views

I want to ask a question that shows a list of software that pertains to the user taking the software in list view. One user may see 2 software's and one may see 24 software's (Depends on the data in the contact list).I have embedded the contact list to the survey flow. I want to ask the following: Are there any software that you would like to keep? (They can then see the software's that pertain to the user taking the survey). They can then select yes or no because it is a multiple choice question. I am not that familiar with javascript so if you could attach it, it would be greatly appreciated. Thank you!!
icon

Best answer by Anonymous 18 October 2018, 12:42

View original

4 replies

Badge +1
When you create your survey question, you can include embedded data in the question itself or in the answer choices.
to add it to the answer choice, click on the drown down arrow by the choice and select Insert Piped Text and then select Embedded Data Field
Alternatively, you can create an answer for all of the software you have to choose from, and create display logic for each answer choice based on the embedded data--so that the person would only see the options that apply to them.
I actually want to display the list of software within the question in list view. So it will ask: Are there any software's you would like to keep: (It would then show the list of software's that pertain to the particular user taking the survey). One user may see 2 and one may see 24. They can then select yes or no because those are my multiple choice options. I once had @Shashi help me out with something similar.
Paste the following code in the js(onReady) of the question
Hello @Cgandhi07


var s=[
"${e://Field/Title 1}",
"${e://Field/Title 2}",
"${e://Field/Title 3}",
"${e://Field/Title 4}",
"${e://Field/Title 5}",
"${e://Field/Title 6}",
"${e://Field/Title 7}",
"${e://Field/Title 8}",
"${e://Field/Title 9}",
"${e://Field/Title 10}",
"${e://Field/Title 11}",
"${e://Field/Title 13}"
]
var i;
var a='';
for (i = 0; i < s.length; ++i) {
if(s[i]!=''){
a=a+"<li>"+s[i]+"</li>";
}
}

jQuery("#"+this.questionId+" .QuestionText").append(a);



Now in the above code just add all the titles in the array
Badge +1
You can include the Piped Text from Embedded data anywhere within the question text as well.

It actually sounds like you want a Matrix question where you can list each software on its own line with Yes / no option next to each one (use display logic). This would give you the data of Which software they want to keep, not just whether they would keep any of them.

When deciding on the question format, keep in mind how you will analyze the data.
For example, if you set up your question as a matrix question with one line for each software on the list, and use display logic with the embedded data to determine whether or not you display that line, then it makes it easy to see how many people were presented with that line, and what their responses were. When you output the data, "software A" will always be in choice 1 and in the same column of data.

But, if the software item/list is piped into the question or into each line, then evaluating the data becomes more difficult. You will easily be able to see the Yes/No, but it will be much harder to analyze which software lists were presented to each client. What did they say "no" to?

Leave a Reply