loop & merge with 3 static questions | XM Community
Skip to main content

Hi everyone,
I have 2 questions:

  1. I want to create loop & merge block, which will display randomly 80 pictures with the same question. Between these questions, I want to insert 3 fixed-location questions (for example, between trials 20 to 21, 40 to 41 and 60 to 61) for checking the subject's attention, with other question. How can I randomized all trials except these ones?

  2. When looking on the download data, I saw that the name of the questions in loop & merge is the entire link of the picture. Can I change this, and give names to the questions before running the experiment?

image.pngI'll be glad to receive your help!

  1. Add JS to set a embedded data field flag to "1" if ${lm://CurrentLoopNumber} is divisible by 20. Otherwise, set the flag to "0". Then add a page break and your attention question to the end of the loop with display logic to only display the question if flag=1.

  2. Edit the Question Text and change the question label at the bottom.



first, thank a lot!

  1. I prefer to know in which trial the subjects are. so I wrote 3 if's. what's wrong with my code?

image.png
2. I mean to the questions' names in loop & merge trials, and can't find where to edit the labels:
image.png


  1. https://www.qualtrics.com/community/discussion/comment/30867#Comment_30867There are a lot of problems with your code:

Qualtrics.SurveyEngine.addOnload(function() {
var flag = 0;
if(parseInt("${lm://CurrentLoopNumber}")/60 == 1) flag = 3;
else if(parseInt("${lm://CurrentLoopNumber}")/40 == 1) flag = 2;
else if(parseInt("${lm://CurrentLoopNumber}")/20 == 1) flag = 1;
Qualtrics.SurveyEngine.setEmbeddedData("flag",flag);
});
On item 2: Move your image to field 2 and use a name if field 1.


OK, thanks.
That's what I did, and the attention questions are not presented at all.
image.pngmaybe you have idea what I did wrong?


https://www.qualtrics.com/community/discussion/comment/30878#Comment_30878You added the JavaScript to the wrong question. It has to be added to the first question in the loop, not the second.


I succeeded. Thank you very much!


Leave a Reply