0 votes
in SoSci Survey (dt.) by s300646 (110 points)

There are several randomizations that I want

3 experimental groups see
8 pictures out of 12 picture pairs (where you only see one picture each pair)

Currently, I chose to have three questionnaires
and within each question I use the rotation of pages.

I use for every picture pair 3 pages: (I do this 12 times)

a PHP for showing either this or that page which includes a random generator of the two pages
question('RG04');
$pages = valueList('RG04', NULL, 'label');
setPageOrder($pages);
2 pages with each an HTML for the picture

and then I have a bigger random generator with a PHP before all the other 12x3 pages
this random generator has 12 blocks (of each three pages) and the same PHP like before
In this random generator, I chose that only 8 pages should be drawn from the 12. This is what doesn't work I guess.

My problem is now:
When I start the demo of the questionnaire, a random number of pictures is shown to me. In the first try, there were only 5 pictures shown to me which doesnt make any sense to me.

How can I test this huge programmization for errors? What are ideas of yours that could be errors? How can I make this less complicated (and therfore less error-prone)?

1 Answer

0 votes
by SoSci Survey (340k points)

You cannot mix loopPage(), loopToPage(), setPageOrder() and setNextPage() or multiple instances of any of these commands. Any of these commands will stop and earlier page order and instead start the own one.

According to your description, this is the most likely explanation what happens.

I use for every picture pair 3 pages: (I do this 12 times)

Depending on what you do on these pages, this sounds like it may be where you do not need a setPageOrder().

by s300646 (110 points)
That means because I have several setPageOrder commands combined they don't work anymore? Does that mean that there is simply no way to combine it like that or is there another command that I can use?

Thanks a lot!
by SoSci Survey (340k points)
There can only be one active page order at a time. You cannot combine multiple setPageOrder() command, right.

What you can do, is to create the complete page order in the very beginning. You can even use the existing random generators for that. Th important part is to create a single array with the full page order, and give that to setPageOrder().
by s300646 (110 points)
Thank you! I still don't understand how to do this in practice as to me it seems to be necessary to have the setPageOrder for each of the page pairs. How would I put all that in one setPageOrder command with 13 different random generator (12 random generator to choose one page for every pair, 1 random generator to  choose 8 of the pairs). Would that be one PHP code before the 24 pages? And no PHP in front of a page pair? If you have an idea in mind, maybe you can give me an example codee? sorry for the detailed questions but this is really a big (and important) task. Thank you!
by SoSci Survey (340k points)
You can use array_merge() to combine multiple arrays. And if I am not mistaken, setPageOrder() also allows for nested arrays. So it might look like this:

$pages = [
  valueList('RG01', null, 'label'),  // First pair
  valueList('RG02', null, 'label'),  // Second pair
  valueList('RG03', null, 'label'),  // Third pair
  ...
];
shuffle($pages);  // This will shuffle only the first level, i.e., the order or pairs
setPageOrder($pages);

I am not sure, if I got all the details of your design. You can, of course, add more pages or groups of pages to the array before/after shuffling.

Give it a try, please, and use debug($pages) to see the result without the need to click through all pages.
by s300646 (110 points)
Thank you! The debugging code shows that the random generator is correctly drawing the random generators

BUT now there are none of the pictures shown any more even though the html for them was right AND there are 12 random generators drawn now even though it should only be 8 --> i feel like the random generator for the bigger randomization (RG02) is somehow missing or wrongly incorporated.

This is my code at the moment:
question('RG02');  

$pages = [
 valueList('RG03', null, 'label'),  // First pair
 valueList('RG04', null, 'label'),  // Second pair
 valueList('RG05', null, 'label'),  // Third pair
valueList('RG06', null, 'label'),
valueList('RG07', null, 'label'),
valueList('RG08', null, 'label'),
valueList('RG09', null, 'label'),
valueList('RG10', null, 'label'),
valueList('RG11', null, 'label'),
valueList('RG12', null, 'label'),
valueList('RG13', null, 'label'),
valueList('RG14', null, 'label')
];
shuffle($pages);  // This will shuffle only the first level, i.e., the order or pairs
setPageOrder($pages,'AP');
by SoSci Survey (340k points)
> BUT now there are none of the pictures shown any more even though the html for them was right

Sounds like the pictures were not places statically on the pages, but are somehow related to the random generators beyond the page order?
by s300646 (110 points)
No, they are placed there statically. Of course, the pages where they are placed are in the random generator, otherwise the whole thing doesn‘t work. Using other code, the pictures were always shown and only looking at the pages, the pictures are also shown.

and what about the 8 out of 12 randomization? (the bigger random generator?)
by s300646 (110 points)
okay, I decided to simplify the design if it doesn't work like that, leaving out the 8 out of 12 random generator, if that is too complicated, but at the moment I still need help because the pictures are not shown
by SoSci Survey (340k points)
> the pictures are not shown

Okay, what do you do to show them? This might be ...

HTML code via html()
HTML code via random generator
HTML code via show() and placeholder
Dragging an image on a page
Dragging a text element with HTML code on a page

What you code does is to the order in which the pages are displayed. However, these pages will have to take care that the pictures are shown. And as you told me nothing about the pages, I have no idea what they contain?
by s300646 (110 points)
Thank you very much! Actually, I found a solution. If anyone is interested in it at some point, I can share it. Your help was really necessary, xx

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...