Question scripting | XM Community
Question

Question scripting

  • 1 May 2024
  • 1 reply
  • 16 views

Userlevel 4
Badge +4

Hi All, 

Can this type of question be created in Qualtrics? I have created a Matrix table with text entry and carry forward choices from the specified question. 

Looking for the same format. 

Thank you

 


1 reply

Userlevel 2
Badge +6

Hi @mdaruka 

I am a bit unclear about what the question is. 

Is the question if you can make this matrix? 
Yes you can do that, but i think that is not your question

Is the question if you can go to this question after you selected something at A2?
Yes you can do that in survey flow

Is the question if you can get a automatic 0 when you dont fill in the question? 
you can try this code.
Qualtrics.SurveyEngine.addOnload(function() {

    // Replace 'QID1' with the ID of your matrix question

    var qid = 'QID1';

    var q = this.getQuestionByQuestionID(qid);

    

    // Loop through each row of the matrix

    for (var i = 1; i <= q.getChoices().length; i++) {

        // If no answer is given, set the value to 0

        if (q.getSelectedChoices().indexOf(i.toString()) === -1) {

            q.setChoiceValue(i, 0);

        }

    }

});

 

You need to replace 'QID1' with the actual Question ID of your matrix question. You can find this ID by inspecting the source code of your survey while editing it in Qualtrics.

Leave a Reply