Hi all,
I have created a block consisting of 1 random selected video and 12 questions. I inserted the loop and merge function to random select 1 video of the 1045 total videos. In total there are 105 loops for every participant, so every participant watches 105 random selected videos and answers the corresponding questions. I want to insert breaks so that after 10 loops, participants can have a break and then continue with the next 10 loops until the full 105 loops are performed. Any ideas on how to this?
Breaks after 10 loops in block with loop & merge function on
Best answer by ahmedA
Okay. I hadn't taken the randomization into account. It basically breaks the code.
Remove the randomization and add this JS to any one question on page 2. It should do the job for you:
Qualtrics.SurveyEngine.addOnReady(function () {
let first_quest = document.getElementById(Object.keys(Qualtrics.SurveyEngine.QuestionInfo)[0]);
Object.keys(Qualtrics.SurveyEngine.QuestionInfo)
.map((a) => document.getElementById(a))
.slice(1)
.map((a) => ({ sort: Math.random(), value: a }))
.sort((a, b) => a.sort - b.sort)
.map((a) => a.value)
.forEach((a) => first_quest.insertAdjacentElement("afterend", a));
});
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
