Randomize order of question sets and response choices

We have about 20 question sets on our data collection tool, each with about 2-10 items. We would like to randomize the order in which two of the question sets among the 20 appear. That is, if we call them question set A and question set B, we would like A to appear first sometimes and B to appear first other times. This is because the content of the question sets are similar and we want to avoid systematically biasing the responses to one of the question sets. The individual items within each question set A and B should retain the same order each time - we only want to randomize which set appears first. Can you suggest code that will allow us to do this? Thanks!

Hi @tworabbits
Welcome to the community forum. I know you asked about randomization of questions in a set. I however expanded your question to look at two components.

  1. Randomization of response choices in select one
    This is possible within the system by adding a parameter definition of randomize=true. This can be done in the XLSforms where you add a column and label it parameter and within the row that contains your select one question you include randomize=true

  2. Randomize questions
    Unfortunately there is no easier way of doing this currently as this functionality is not inbuilt. You can however do this using a much longer approach which requires some adjustments to your questionnaire as follows:

a. Create an initial calculate question which generates a random number
b. Work out your block of X number of questions
c. Make a group called ORDER 1

  • Put the complete set of questions inside this group
  • Set the relevant field for the begin group line to be if the random number is between X and Y
    d. Make a group called ORDER 2
    -Put the complete set of questions inside this group in a different order from ORDER1
    -Set the relevant field for the begin group line to be if the random number is between Y and Z

e. REPEAT until you have the desired number of groups. Obviously the values of the relevant field depend on how many ordering you end up with.

Note original credit for this approach goes to MIchael


1 Like

Hello anyone can help with this.
For reproducible randomization, I have randomized with the parameters and explicitly provided with seed.
What I want to know is how can we prevent re-randomization/re-selection after we have selected one items.
For example; there will be 5 options: 1, 2, 3, 4, 5 for randomization, if we have selected 2 and continued data entry relating with 2. Then, 2 can be reselected and do data entry again for the second time in one question set.
My question here is how can we prevent such double data entry for option 2 questions? Is it possible to prevent re-selection to the option 2 again in questionnaires set after it has competed the first time?
How can we formulate in form building in xls?
Thanks in advance

Hi @mhl
Your issue has been discussed previously. In summary, data collection within a form does not have the relational capability between different data collection instances i.e. administrations of the form. As such you cannot be able to control for that number not to be picked again within the system You must have an off system approach at doing it; which we do not provide support on.

1 Like

Hi @tworabbits, @mhl,

Maybe the following workaround would help you solve your issue:

In the survey tab of your xlsform:

Image 1

Data entry screen as seen in Enketo: Set 1

Data entry screen as seen in Enketo: Set 2

Reference xlsform:

Selecting one set of questions randomly.xlsx (47.6 KB)

Hello @Kal_Lam
I am afraid, value 0.5 for the random result is not covered in the example. Can be changed to any_1 >=0.5. (At the moment it might result in showing NO questions.)