Displaying selected answers from previous questions | XM Community
Skip to main content

Displaying selected answers from previous questions

  • September 13, 2022
  • 4 replies
  • 1384 views

Forum|alt.badge.img+1

Hello! I am new here. I would like to know if it is possible to display the statements that were picked in the previous questions in their respective scale point in a later question (i.e. the chosen statements in Q1 goes into most characteristic for Q3, the chosen statements in Q2 goes into most uncharacteristic for Q3 and the remaining 2 goes into the Neither Nor scalepoint) ? The images below are an example of what I am trying to do.
image.pngimage.pngimage.png

4 replies

ElieD
QPN Level 4 ●●●●
Forum|alt.badge.img+39
  • QPN Level 4 ●●●●
  • 132 replies
  • September 13, 2022

Hi,

You can easily show previous question anwser by using piped text.
You have to choose a "Text/Graphic" item and display in another block in order to have the data.
image.pngYou will have a little css work to do if you want to customize the display, but it works !


ElieD
QPN Level 4 ●●●●
Forum|alt.badge.img+39
  • QPN Level 4 ●●●●
  • 132 replies
  • September 14, 2022

Another option is to use the "pick, group and rank" question type


Forum|alt.badge.img+1
  • Author
  • 3 replies
  • September 30, 2022

Hi ElieD thanks for replying. While I have not tried the suggestions, I kind of need it to be in the matrix table format with drag and drop options. I saw on a project somebody did that I think used javascript to display the selected choices. I would have asked the person but they are no longer around. Their code looked like this:
Qualtrics.SurveyEngine.addOnReady(function()
{
    /*Place your JavaScript here to run when the page is fully displayed*/
    let ques = this;
    let a1 = "${q://QID327/ChoiceGroup/SelectedChoices}";
    let a2 = "${q://QID333/ChoiceGroup/SelectedChoices}";
    let b1 = "${q://QID333/ChoiceGroup/UnselectedChoices}${q://QID334/ChoiceGroup/UnselectedChoices}";
    let c1 = "${q://QID328/ChoiceGroup/SelectedChoices}";
    let c2 = "${q://QID334/ChoiceGroup/SelectedChoices}";
    
    let choice_text = ques.getChoiceContainer().innerText.split(/\\n/gm);
    let all_choices = ques.getChoices();
    let all_answers = ques.getAnswers();

    for (let i = 0; i < choice_text.length; i++) {
        let set_choice = -1;
        switch (true) {
            case a1.includes(choice_text[i]):
                set_choice = all_answers[0];
                break;
            case a2.includes(choice_text[i]):
                set_choice = all_answers[1];
                break;
            case b1.includes(choice_text[i]):
                set_choice = all_answers[2];
                break;
            case c2.includes(choice_text[i]):
                set_choice = all_answers[3];
                break;
            case c1.includes(choice_text[i]):
                set_choice = all_answers[4];
                break;
        }
        ques.setChoiceValue(all_choices[i], set_choice, true);
    }
    
    });

But I can't seem to make it work in a different context (different number of scale points).


ElieD
QPN Level 4 ●●●●
Forum|alt.badge.img+39
  • QPN Level 4 ●●●●
  • 132 replies
  • October 3, 2022

Hi Isobob,

Do you have some more context ?
I can't reproduce the feature with javascript code only.