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

Hello! I have previously asked this question but the answers given were not quite what I was looking for, so I will try to clarify it better here. Essentially, I have the survey set up in this "pick, group and rank" format, where participants would select 2 statements they feel are characteristic and uncharacteristic to them, the remaining 2 statements would then be piped into a 3rd group as per the 3rd photo attached below.
The main aim for this is to allow the participants to confirm the statements, or if they want to make changes within groups, they can drag and drop accordingly.
image.pngimage.pngimage.pngAs far as I know, the matrix table option does not allow us to type into the individual groups to pipe answers. Someone who set up a survey similar to this and used the matrix table had a javacript as follows:
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_textri]):
                set_choice = all_answers(0];
                break;
            case a2.includes(choice_textri]):
                set_choice = all_answersr1];
                break;
            case b1.includes(choice_texti]):
                set_choice = all_answersr2];
                break;
            case c2.includes(choice_textii]):
                set_choice = all_answers3];
                break;
            case c1.includes(choice_textbi]):
                set_choice = all_answersh4];
                break;
        }
        ques.setChoiceValue(all_choicesi], set_choice, true);
    }
    
    });
I'm unsure how the javascript is supposed to work, as I am unable to get the javascript to run in a different context (different number of scale points, different number of statements). I am unable to contact them as they are no longer around. It would help a lot if somebody could help explain the javascript part, please and thank you!

That JS isn't going to help you. You'll need to move the statements into the groups, which that JS doesn't do.
If you don't care about the rankings within groups, you should be using a drag and drop matrix instead of pick, group, rank.


TomG Hi, thank you for replying. I have changed all the questions into a drag and drop matrix, however it still did not carry forward the statements into the respective groups in the last, consolidated matrix.


https://community.qualtrics.com/XMcommunity/discussion/comment/50317#Comment_50317You'll need to use JS to do that. It will need to simulate moving the items into the groups.


Leave a Reply