Translations of this page:
 

Randomization: Pages

In case you want to randomize full pages this can be realised with PHP-Code. This guide describes how to send the respondent through the questionnaire in one of three possible ways, depending on a random draw.

Tip: Start with the instruction Rotate Pages. This instruction discribes different application cases step for step.

The The inclusion of the PHP code described here is already the 2nd step of the randomization. Make sure you read the chapter Randomization with PHP-Code first. It describes how to create the Random Generator for random selection and where to place the PHP code on the page.

If the order of questions is to be varied in a more complex way, filters can quickly become confusing. In this case the PHP function setPageOrder() may help. With this function the sequence of the page can be varied. To use this feature, please also read about page identifiers.

In the following example, the function setPageOrder() – depending on the random draw – is called with different page orders.

// The random number rolled via RG01
$number = value('RG01');
 
// Depending on the draw, one of three paths is used
if ($number == 1) {
  setPageOrder('q1','q2','mainStart-mainEnd','q3');
} elseif ($zahl == 2) {
  setPageOrder('q1','mainStart-mainEnd','q2','q3');
} else {
  setPageOrder('q2','q1','mainStart-mainEnd','q3');
}

Further instructions and examples can be find in the reference to the function setPageOrder().

en/create/randomization-page.txt · Last modified: 30.09.2021 11:27 by sophia.schauer
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki