Save mutliselectes choices as embedded data | XM Community
Skip to main content

Hi There,

Still learning in Qualtrics, but is there a way I can store data in from a multi choice question seperated in embedded data. 

For example:

Question 1 has 30 options: 

Question 1 answers is:

mail1, mail3, mail9, mail 11

Embedded data:
email1: mail1
email2: mail3
email3: mail9
email4: mail11

I tried using piped text but I get all selected options.

Greetings,

Celino

Yes, we need to use JS to set this up. Create 30 embedded data in survey flow. Using JS loop through the selected options and set embedded data one by one.


Yes, we need to use JS to set this up. Create 30 embedded data in survey flow. Using JS loop through the selected options and set embedded data one by one.

Qualtrics.SurveyEngine.addOnload(function() {
    // Replace 'QID171' with the actual question ID
    var questionId = 'QID171';

    // Get the selected choices from the multi-choice question
    var selectedChoices = Qualtrics.SurveyEngine.getSelectedChoices(questionId);

    // Set each selected option in separate embedded data fields
    for (var i = 0; i < selectedChoices.length; i++) {
        var embeddedDataName = 'email' + (i + 1);
        var selectedChoiceText = jQuery("#" + questionId + " labelqqid='" + selectedChoices'i] + "']").text().trim();
        Qualtrics.SurveyEngine.setEmbeddedData(embeddedDataName, selectedChoiceText);
    }
});

I tried to use this javascript but dont receive anything on the embedded data email1 or email2.

The QID for the mail question is 171 as example.


Leave a Reply