I I understand you correctly, the 3000 texts are already complete vignette combinations, not the partial elements of your textes (this was what my recent answer was based on). And you're working with a systematic sample of 300 vignettes.
Building decks is not necessary technically, but may be sensible by means of method. If you choose not working with decks, you would just draw 30 of 300 texts per interview (using a random generator question). If you choose to work with decks, you draw just one element from a list 1..30 (using a random generator as well).
Alright. Now you have a series of options how to complete that. Let's stay with the decks option: Let's say your random generator has the ID RG01 and to make it easy, you have put the text IDs (just give each an ID from 1 to 300) as content into the random generator, e.g., using a comma as separator:
1=1,2,3,4,5,6,7,8,9,...,30
2=31,32,33,34,35,...,60
etc.
You can easily prepare such a list in Excel and copy it into the random generator. And you may as well use some kind of space instead of the comma. Now value('RG01', 'label')
will give you exactly that combination, which you can split into an array, using explode()
. This is the first part of you PHP code:
if (!isset($com)) {
$val = value('RG01', 'label');
$com = explore(',', $val);
registerVariable($com);
}
If you want to display the question QN01 to QN30 for the 30 texts of the deck, this would be accomplished this way. Let's assume that your texts in the database for contents have the keys 'TX1' to 'TX300'.
$i = loopPage(count($com));
$qID = 'QN'.sprintf('%02d', $i + 1);
$textID = 'TX'.($i + 1);
// Display question and text
$data = dbGet($textID);
$text = $data[0];
html('<p>'.$text.'</p>');
question($qID);
Another optinon...
... would be to do the assignment of texts to decks, using the keys. If you prefer that, let's say deck 1 has the codes 'D101' to 'D130', deck 2 uses the codes 'D201' to 'D230' and so on. Then the random generator does not need the combinations at all, just create a random generator with that content:
1=Deck 1
2=Deck 2
etc.
In the questionnaire, use this PHP code to display the texts from the database for contents, and the questions with the IDs as known from above:
$deck = value('RG01');
$i = loopPage(30);
$textID = 'D'.$deck.sprintf('%02d', $i + 1);
$qID = 'QN'.sprintf('%02d', $i + 1);
// Display question and text - like before
$data = dbGet($textID);
$text = $data[0];
html('<p>'.$text.'</p>');
question($qID);
Should you be interested in the solution without decks, feel free to ask a new question :)