Is there a way to populate selections from a previous question? | XM Community

Is there a way to populate selections from a previous question?

  • 16 May 2020
  • 1 reply
  • 26 views

Badge +2

I have a need to populate answers from a previous question.
I have 5 questions with the same 100 selection options.
4 of those questions are displayed to the survey taker via a selection option.
The first 100 selection option needs to then populate the answers into the next 4 questions based on whether or not they are supposed to see the question.
Lastly any options that are changed or newly selected then need to fill the next questions available.

Example
Q1. I have a multiple selection answer.
A Check

C Check

Q2. This question will have the exact same answers plus all the unselected items.
A Unchecked, by user
B Check
C Unchecked, by user

Q3. This question will have the exact same answers plus all the unselected items.

B Unchecked, by user
C Check

Q4. This question will have the exact same answers plus all the unselected items.

B Check 
C Check


1 reply

Badge +2

This is what we came up with...

First multi-select question.
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/

/* Put the array of seleted values into the Embeded Data in the SurveyEngine */
Qualtrics.SurveyEngine.setEmbeddedData ( "Selections", this.getSelectedChoices () );
});

Subsequent multi-select questions

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
//Hold onto this to keey the correct context for changing choice values
var that = this;
//Pull the selected choice array out of the SurveyEngine Embeded Data
var selections = Qualtrics.SurveyEngine.getEmbeddedData ( "Selections");
//Loop through the selected choices and set those choices.
selections.forEach (function(item) {
that.setChoiceValue(item, true);
});
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
/* Put the array of seleted values into the Embeded Data in the SurveyEngine */
Qualtrics.SurveyEngine.setEmbeddedData ( "Selections", this.getSelectedChoices () );
});

Leave a Reply