How do I create a cumulative ceiling based on scores? | XM Community
Skip to main content

I have created a survey that will act as a language assessment and I need to add basal and ceiling. Specifically, out of 60 questions, I need the first ten to always be answered. At the 11th question, I need to move to the next survey block after 6 consecutive wrong answers - there are four answer options for each question. When an answer is correct, the number of wrong answers is reset to zero. For example, if I answer questions 11-15 incorrectly, but get #16 right, the count is reset.

 

Can anyone help me with the logic/javascript on this?


@vaz235 : 

 Here’s an example of the JavaScript code to reset the count:

 

if("${e://Field/YourAnswer}" == "CorrectAnswer") {
 Qualtrics.SurveyEngine.setEmbeddedData("ConsecutiveWrongCount", 0);
} else {
    var consecutiveWrongCount = parseInt("${e://Field/ConsecutiveWrongCount}");
    Qualtrics.SurveyEngine.setEmbeddedData("ConsecutiveWrongCount", consecutiveWrongCount + 1);
}


Hello I am trying to help @vaz235 and I tried the following but I cannot get the ConsecutiveWrongCount to set.

I declared a “Score” and “ConsecutiveWrongCount” in a block above this scoring question block where the JS will run. I tried the follow JS code any help is much appreciated!

 

Here I am trying to tell it on question 11 answer choice 1 (the right answer) set the count to 0. 

Qualtrics.SurveyEngine.addOnPageSubmit(function()                                    
{
    if("${q://QID11}" == "${q://QID11/ChoiceDescription/1}") {
 Qualtrics.SurveyEngine.setEmbeddedData("ConsecutiveWrongCount", 0);
} else {
    var consecutiveWrongCount = parseInt("${e://Field/ConsecutiveWrongCount}");
    Qualtrics.SurveyEngine.setEmbeddedData("ConsecutiveWrongCount", consecutiveWrongCount + 1);
}

});

 

Here I am using the scoring that is setup in the the block and if the score is 1 set the wrong count to 0.

Qualtrics.SurveyEngine.addOnPageSubmit(function()                                    
{
    if("${e://Field/Score}" == "1") {
 Qualtrics.SurveyEngine.setEmbeddedData("ConsecutiveWrongCount", 0);
} else {
    var consecutiveWrongCount = parseInt("${e://Field/ConsecutiveWrongCount}");
    Qualtrics.SurveyEngine.setEmbeddedData("ConsecutiveWrongCount", consecutiveWrongCount + 1);
}

});


Leave a Reply