Is there a way to skip to the end of a block based on an entered value being > or < an integer? | XM Community
Skip to main content

I believe this is doable through javascript, but would anyone be able to help me figure out how to skip to the end of a block using logic captured earlier in the survey?

For example, a respondent is asked to pick a number, and then if a randomly drawn number is higher than that, I would like Qualtrics to automatically end the trial by skipping to the end of the block (it's an experiment). Any ideas would be beneficial, thanks!

You wouldn't do this in JavaScript. You should use survey flow branch logic. It might look something like:
image.png


Unfortunately, I need to be able to implement this skipping mechanism on a question-by-question basis. Each question is a new randomly generated number, and it seems this would not allow me that granularity.


maybe you could set a display logic on each question in your block

  1. create embedded data fields

  2. randomNumber and showQuestions

image.pngquestion setup
image.pngadd to the text entry question the below javaScript

Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
let randomNumber = "${e://Field/randomNumber}"
let enteredNumber = document.getElementById('QR~'+this.questionId).value
let showQuestion 

if(Number(randomNumber) > Number(enteredNumber)){

showQuestion = 1
}else if(Number(randomNumber) < Number(enteredNumber)){
 showQuestion = 0
}

Qualtrics.SurveyEngine.setEmbeddedData("showQuestions",showQuestion);
});

add the display logic to all questions in your block

hope this is what you are going for

Best regards

Rudi


Leave a Reply