Thank you for your answer to my previous question. However, as this is my first time using SoSci Survey and I lack any kind of programming experience, I'm afraid I must ask for a bit more clarification.
Firt, it is important to have the responses for image 1 in the same variables in every interviews, no matter at which position the image is displayed.
I'm not sure how to do this. Is there a page in the manual explaining the code necessary for this? Where should I put this code?
How many images do you have overall? If it's more than a dozend, I
would strongly recommend to use a multi-level structure here. This
will also easy the 9-page-blocks a lot.
What would be good solution in my opinion: Create a
master-questionnaire with a random generator that will draw all (!)
images per interview. The number of images is also the limit of
repetitions
I have 108 images in total. I've created a master questionnaire and a random generator with all images, set to '108 codes drawn per interview' and 'equally distributed'. I'm unsure where in the questionnaire I should put the random generator?
Then use valueList() and array_chunk() to get the list of images (or
their codes) and split them in blocks of 9. Then insert a -1 between
the blocks. This is a proper signal for the sub-questionnaire to
display the choice question. Another option would be to create 9 pages
in the sub-questionnaire, but that would complicate the data
structure, compared to a one-image sub-questionnaire.
Based on the above I've created this code:
$codes = valueList('T304'); // 'T304' is the Question ID of the random generator.
shuffle($codes);
$codes = array_chunk($codes, 12); // I've divided the 108 codes into 12 chunks to get 9 per chunk.
registerVariable($codes);
html('<p>Length of array: '.count($codes).'</p>'); // This html is just to check that the array chunk is working properly (it displays '9').
if (count($codes) > 0) {
$code = loopPage($codes);
multiLevelDown(SQ); // 'SQ' is the sub questionnaire's ID.
} // This is an attempt at looping the sub questionnaire 12 times. I'm not sure if it's correct.
I'm unsure if all of this code should be on the same page. I also don't know where or how to incorporate the -1 you mentioned. Related: Based on your wording, I assume the "continue?" page should be in the sub questionnaire as well? If a participant chooses "continue" on this page, and the answer sends them to the page in the master questionnaire which starts the sub questionnaire, will the loop end when the sub questionnaire's been answered 12 times?
In addition to the above, I don't understand how to display the images the values represent. I assume I am to use this html on the sub questionnaire page:
html('
<div style="margin: 3em; text-align: center">
<img src="'.$img.'" alt="" />
</div>
But I don't know what to set the $img variable as.
I apologise for the many questions. I've tried to reference the manual, but some things are hard to understand due to my lack of programming experience and translation from German. As you can tell, I'm rather lost and would appreciate any help.