I’m working on a questionnaire in XLSForm that consists of three blocks of questions. All respondents must answer all three blocks, but I want the order of the blocks to be randomized for each respondent. I do not want to randomize the questions within the blocks—only the order of the blocks themselves.
Is there a way to achieve this in XLSForm? I would really appreciate any guidance.
Thanks in advance for your help!
Best,
Clara
There are a few different ways you can do this, perhaps the simplest being to group all your blocks (ie subgroups!) into a group, generate all possible permutations [for randomizing 3 things will give you a total of 6 possible permutations] and then just generating a random number between 1 and 6 and using that in a relevant expression against each permutation super-group.
This is basically the same brute-approach taken to randomizing questions: create a group for all possible permutations, and then select one of these groups at random. That way you randomly present a different permutation of question each time. Obviously, however, this gets tedious the more things you want to randomize. Specifically, it grows factorially: 4 items=24 permutations, 8 items=40320! So 3 is probably the maximum I’d try to apply this approach with.
Alternatively, I have previously posted a general purpose approach to randomizing an arbitrary number of things; this was ostensibly for randomizing the order to questions, but the same basic approach can also be applied to randomizing an arbitrary number of groups too.
I wont go into the details of how the algorithm works here - please see the original post. All I’ve done to adapt it to your usecase is replace each question that was being randomized before with a group (of 2 questions). Everything else is pretty much verbatim.