Hi there!
I have to categorize answers to groups and am using embedded data for that. It works for all my single response questions but with the multi sesponse question it does not work. It should be simple but somehow I was not able to find a soluteion so far
var zwinf_kat= "";
if("${q://QID115/SelectedChoicesRecode}" == "1") {zwinf_kat="1"};
if("${q://QID115/SelectedChoicesRecode}" == "2") {zwinf_kat="1"};
if("${q://QID115/SelectedChoicesRecode}" == "3") {zwinf_kat="2"};
Qualtrics.SurveyEngine.setEmbeddedData( "zwinf_kat", zwinf_kat);
Thank you for your help :-)
Cheers
Hi again! I tried it with Choice Group and it worked. BUT referring to the value instead of a text would be much better (I have way more than 3 items and I have different questions so I think it's dangerous to work with "text" instead of a value (if only one letter changes it will not work any more): Does anyone have an idea?
So I have got:
var zwinf_grob= "";
if("${q://QID115/ChoiceGroup/SelectedChoices}" == "ja, persönlich") {zwinf_grob= "1"};
if("${q://QID115/ChoiceGroup/SelectedChoices}" == "ja, telefonisch") {zwinf_grob= "1"};
if("${q://QID115/ChoiceGroup/SelectedChoices}" == "nein") {zwinf_grob= "2"};
Qualtrics.SurveyEngine.setEmbeddedData( "zwinf_grob", zwinf_grob);
amd I would like to have something like that (which does not work).
var zwinf_grob= "";
if("${q://QID115/ChoiceGroup/SelectedChoices/Value}" == "1") {zwinf_grob= "1"};
if("${q://QID115/ChoiceGroup/SelectedChoices/Value}" == "2") {zwinf_grob= "1"};
if("${q://QID115/ChoiceGroup/SelectedChoices/Value}" == "3") {zwinf_grob= "1"};
Thank you!!!!
${q://QID115/ChoiceGroup/SelectedChoices} is a comma separated list of choices. So,
var zwinf_grob = "";
jQuery.each("${q://QID115/SelectedChoicesRecode}".split(", "), function(i, val) {
if(val=="3") zwinf_grob = "2";
else zwinf_grob = "1";
});
Qualtrics.SurveyEngine.setEmbeddedData( "zwinf_grob", zwinf_grob);
Thank you, Tom! Awesome!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.