Alternating Questions between two questions blocks | XM Community
Skip to main content
Hi all,



I am new to qualtrics and I am hoping someone can help me out with a problem:



I have 20 questions I want to ask in total. 10 of them are framed 'positively' and 10 are framed 'negatively'. What I want to do is randomize the question order, but also alternate between a positively and negatively framed question (ie; +,-,+,-..). Can this be done?



Thanks in advance!
Hi @akcooper,

if the question is of the same type, you can use Loop&merge together with JavaScript.





Before the loop&merge block:

1) Create two arrays containing sequences from 0 to number of elements -1.

2) Put some two strings before elements of each array (e.g.: "n" for negative indexes and "p" for positive ones).

3) Randomize order of these arrays.

4) Merge these arrays into one such that it is in the order you want (i.e.: +,-,+,-..; you can use for example `for` loop).

5) Store your questions in a file/embedded field with some separator which is not inside your questions. Positive ones and negative ones should be stored separately.





In the loop&merge block:

1) Get your strings with questions and ids (you can use piped text) and split them to arrays again.

2) Select actual index according to the current loop number (use piped text to get it). Be aware that first array index is 0, but first loop number 1.

3) Select the correct array with questions and the correct questions (you'll probably have to split each array element)

4) Put the selected element to the text of the question. This can help you to do it.

Leave a Reply