Is it possible to deactivate/stop randomization in a MCQ after the first loop during Loop & Merge? | XM Community
Skip to main content

Dear community,
I have a block for which I use Loop & Merge (8 loops in total). In the beginning, I have a question in which the choices are randomized. I would like that this question only runs in the first loop to avoid randomization of the choices at the beginning of the following loops. Is there a way to achieve this? I know that it is possible with JS to hide a question after the first loop but then it would still do the randomization so this would not work for me...
Thanks for your help in advance!!


You can set a variable once that question is shown and then apply logic as if current loop is the initial value that you set to show only then, instead it won't be shown.


Hi,
That seems like a great idea! Just so I am fully clear - do you mean I should set a variable in JS and then just implement an if-condition or do you mean I should actually apply skip logic from the side menu? I could imagine that it works like with the code below but instead of the hide I need something else like a skip function but I do not know if that exists?
var q = jQuery("#"+this.questionId);

if("${lm://CurrentLoopNumber}" != "1") jQuery("#"+this.questionId).hide();

I also tried another way that I think might work but it doesn't work just yet. First, I created an embedded data element called skipQ, then I inserted the code below into the question and lastly, I implemented a display logic where I say that the question should be skipped if the value of the embedded data field is not equal to 1. However, it doesn't skip it, unfortunately. Any idea what I might be doing wrong?

Qualtrics.SurveyEngine.addOnUnload(function(){

Qualtrics.SurveyEngine.setEmbeddedData('skipQ', '2');

});


Thanks so much!


You will need to set a counter variable in onLoad and then onPageSubmit just increment the value to let's say 2 and then display logic should be if my variable is the initial value like 1.
You can set the initial counter in survey flow as well. Just remember to increment the same in onPagesubmit on first occurance and it will follow the same.


An easier way to do this is to add the MC question in a block before the loop, randomize the choices, and hide it with JS. Then carryforward the choices to your MC question inside the loop.


Both answers worked! Thank you! In the end, I created embedded data (skip Q = 1), changed the JS code of the following question so that the embedded data is updated to skipQ = 2, and then implemented display logic (display if skipQ is equal to 1).


Leave a Reply