0 votes
in SoSci Survey (English) by s243157 (150 points)

Thank you for your response!

I have one question remaining: if I intend to make a monolingual split survey, how can I do that?

The sampling material would be too large to include in one survey (40 questions with 3 or 4 sentences each) and I have decided to split the survey in half, so either group of respondents would only have to answer 20 questions. A further problem is that in addition to these split surveys, translated versions have already been created, although here I am not sure how this would influence the above problem, if it does at all.

Is it possible to add another "translated version" but in the same language to the project? Or should I be starting a new project to do this?

Here I have given the link of the project with some of the surveys ready - the one missing is the second Danish survey which ideally should appear next to these versions.

https://www.soscisurvey.de/da2023survey/?act=auyNda6ERYiGCQQxUcTOfgeq

Thank you for your help in advance.

1 Answer

0 votes
by SoSci Survey (328k points)

One option would be to randomly draw 20 out of the 40 questions.

Please follow the manual Rotate Questions, but draw only 20 instead of all questions per interview (setting in the random generator).

This should work well with multilingual survey projects. However, if you need to make sure that each question is asked euqally often in each language, then you would have to go a step further: Randomization per Block

by s243157 (150 points)
Thank you for your response!

The other three testing languages are not concerned in the randomization so I am not sure if they would automatically be affected by setting the Randomization Generator in the base language version of the project.

For the record, I have originally created all of the questions in the base language (Danish), that is, all forty of them and placed them in the survey 20-20 questions appearing across two pages as I thought that it would be more convenient for the informants not to have all of them in one.

I have watched a tutorial video on Youtube (link provided here if needed: https://www.youtube.com/watch?v=_H_wt3I7ssQ) where the questions are created together with the Randomization Generator where the IDs are added, but only the PHP code is put into the questionnaire at the Compose Questionnaire page since the code provides the instructions for the randomization to happen. I followed the questions up to the point where the PHP code is added, but upon testing the survey, I receive an error message stating that “There is no question ID in question().” This is present on each page where I insert the PHP code with the ID, but it does not appear when the PHP code with the instruction is missing. Similarly, no shuffling happens when the code is not inserted at all on the page /Compose questionnaire./

I assume that at least one of the problems could be that I have also inserted the individual questions across the two pages - but from what I understand they had to be as they are combined questions using a PHP instruction (combine=). Thus, if I were to take these PHP codes out, the combinations would be undone (please, correct me if I am mistaken.)

My question would be thus, what should I do, if I would like to have the program to choose 20 PHP codes (which actually involve two combined questions) out of a total of 40 (80 individual questions combined with a PHP code)? Each question (or in this case PHP code including the questions) should only be included once in every sampling round and overall all questions are represented equally. Furthermore, this randomization/rotation should apply exclusively to one language version (the main one) since it includes 40 questions and the other three 25-25 each, so there is no need for question extraction there.

I am sorry for this long post - it is only intended to reflect me not understanding how to manage the issue as I am quite new to programming. Please, do not hesitate to ask for more details/information if you deem that what I have outlined above is lacking in something. I am grateful for your help.
by SoSci Survey (328k points)
Translations of the questions are usually independent from randomization. In your case, you would select questions in the random generator, and the interviews cecides the language that these questions will use.

> but only the PHP code is put into the questionnaire at the Compose Questionnaire page

Yes, you would remove the 40 questions (or the two pages) from the questionnaire, and just use PHP code to show (some of) them.

>  I followed the questions up to the point where the PHP code is added, but upon testing the survey, I receive an error message stating that “There is no question ID in question().”

That's the point where I would like to ask you to post the debug information shown on that page: https://www.soscisurvey.de/help/doku.php/en:create:debugging

>  but from what I understand they had to be as they are combined questions using a PHP instruction (combine=)

Are you using combined questions (https://www.soscisurvey.de/help/doku.php/en:create:combine) so far? If not, you won't need them for randomization.

> what should I do, if I would like to have the program to choose 20 PHP codes

I understand that you have been using combines questions before? Okay, that makes the code a little bit more complicated, but not that bad.

Let's start with selecting and presenting the normal questions (use the first of each combined questions for now), and when that PHP code runs, let's take care of the two combined questions.

> I am sorry for this long post

Well, you'll have to read my long answer ;)

> I am quite new to programming

It's the perfect time to learn a bit programming. That's very useful in many situations, including data analysis.
by s243157 (150 points)
Thank you for the swift reply!

Sure thing, I'll start by posting the debug information here (it is quite long, but as I understand, the issue is the same everywhere):

[Information]    Interview number 90 is to be continued
[Information]    Questionnaire sociodemographics from project da2023survey will be used
[Information]    Retention period on page 3 has been 81 seconds
[Processing]    Reading answers from page 3
[Information]    Answer missing for SP03_01
[Information]    Answer missing for SP03_02
[Information]    Answer missing for SP03_03
[Information]    The question SP03 is missing a required answer
[Information]    Answer missing for SP23_01
[Information]    Answer missing for SP23_02
[Information]    Answer missing for SP23_03
[Information]    Answer missing for SP09_01
[Information]    Answer missing for SP09_02
[Information]    Answer missing for SP09_03
[Information]    The question SP09 is missing a required answer
[Information]    Answer missing for SP24_01
[Information]    Answer missing for SP24_02
[Information]    Answer missing for SP24_03
[Information]    Answer missing for SP17_01
[Information]    Answer missing for SP17_02
[Information]    The question SP17 is missing a required answer
[Information]    Answer missing for SP25_01
[Information]    Answer missing for SP25_02
[Information]    Answer missing for SP14_01
[Information]    Answer missing for SP14_02
[Information]    The question SP14 is missing a required answer
[Information]    Answer missing for SP26_01
[Information]    Answer missing for SP26_02
[Information]    Answer missing for SP10_01
[Information]    Answer missing for SP10_02
[Information]    Answer missing for SP10_03
[Information]    The question SP10 is missing a required answer
[Information]    Answer missing for SP27_01
[Information]    Answer missing for SP27_02
[Information]    Answer missing for SP27_03
[Information]    Answer missing for SP15_01
[Information]    Answer missing for SP15_02
[Information]    Answer missing for SP15_03
[Information]    The question SP15 is missing a required answer
[Information]    Answer missing for SP28_01
[Information]    Answer missing for SP28_02
[Information]    Answer missing for SP28_03
[Information]    Answer missing for SP12_01
[Information]    Answer missing for SP12_02
[Information]    Answer missing for SP12_03
[Information]    Answer missing for SP12_04
[Information]    Answer missing for SP12_05
[Information]    The question SP12 is missing a required answer
[Information]    Answer missing for SP29_01
[Information]    Answer missing for SP29_02
[Information]    Answer missing for SP29_03
[Information]    Answer missing for SP29_04
[Information]    Answer missing for SP29_05
[Information]    Answer missing for SP08_01
[Information]    Answer missing for SP08_02
[Information]    Answer missing for SP08_03
[Information]    The question SP08 is missing a required answer
[Information]    Answer missing for SP30_01
[Information]    Answer missing for SP30_02
[Information]    Answer missing for SP30_03
[Information]    Answer missing for SP18_01
[Information]    Answer missing for SP18_02
[Information]    Answer missing for SP18_03
[Information]    Answer missing for SP18_04
[Information]    The question SP18 is missing a required answer
[Information]    Answer missing for SP31_01
[Information]    Answer missing for SP31_02
[Information]    Answer missing for SP31_03
[Information]    Answer missing for SP31_04
[Information]    Answer missing for SP05_01
[Information]    Answer missing for SP05_02
[Information]    Answer missing for SP05_03
[Information]    The question SP05 is missing a required answer
[Information]    Answer missing for SP32_01
[Information]    Answer missing for SP32_02
[Information]    Answer missing for SP32_03
[Information]    Answer missing for SP16_01
[Information]    Answer missing for SP16_02
[Information]    The question SP16 is missing a required answer
[Information]    Answer missing for SP33_01
[Information]    Answer missing for SP33_02
[Information]    Answer missing for SP19_01
[Information]    Answer missing for SP19_02
[Information]    The question SP19 is missing a required answer
[Information]    Answer missing for SP34_01
[Information]    Answer missing for SP34_02
[Information]    Answer missing for SP06_03
[Information]    Answer missing for SP06_04
[Information]    Answer missing for SP06_05
[Information]    Answer missing for SP06_06
[Information]    The question SP06 is missing a required answer
[Information]    Answer missing for SP35_03
[Information]    Answer missing for SP35_04
[Information]    Answer missing for SP35_05
[Information]    Answer missing for SP35_06
[Information]    Answer missing for SP11_01
[Information]    Answer missing for SP11_02
[Information]    Answer missing for SP11_03
[Information]    Answer missing for SP11_04
[Information]    Answer missing for SP11_05
[Information]    The question SP11 is missing a required answer
[Information]    Answer missing for SP36_01
[Information]    Answer missing for SP36_02
[Information]    Answer missing for SP36_03
[Information]    Answer missing for SP36_04
[Information]    Answer missing for SP36_05
[Information]    Answer missing for SP69_01
[Information]    Answer missing for SP69_02
[Information]    Answer missing for SP69_03
[Information]    Answer missing for SP69_04
[Information]    The question SP69 is missing a required answer
[Information]    Answer missing for SP70_01
[Information]    Answer missing for SP70_02
[Information]    Answer missing for SP70_03
[Information]    Answer missing for SP70_04
[Information]    Answer missing for SP71_01
[Information]    Answer missing for SP71_02
[Information]    The question SP71 is missing a required answer
[Information]    Answer missing for SP72_01
[Information]    Answer missing for SP72_02
[Information]    Answer missing for SP73_01
[Information]    Answer missing for SP73_02
[Information]    The question SP73 is missing a required answer
[Information]    Answer missing for SP74_01
[Information]    Answer missing for SP74_02
[Information]    Answer missing for SP75_01
[Information]    Answer missing for SP75_02
[Information]    The question SP75 is missing a required answer
[Information]    Answer missing for SP76_01
[Information]    Answer missing for SP76_02
[Information]    Answer missing for SP77_01
[Information]    Answer missing for SP77_02
[Information]    Answer missing for SP77_03
[Information]    The question SP77 is missing a required answer
[Information]    Answer missing for SP78_01
[Information]    Answer missing for SP78_02
[Information]    Answer missing for SP78_03
[Information]    Answer missing for SP79_01
[Information]    Answer missing for SP79_02
[Information]    The question SP79 is missing a required answer
[Information]    Answer missing for SP80_01
[Information]    Answer missing for SP80_02
[Information]    0% of the questions have been answered so far
[Processing]    Create page 3 in questionnaire sociodemographics
[Content]    Create question SP02
[Content]    Create question SP03+SP23
[Content]    Create question SP09+SP24
[Content]    Create question SP17+SP25
[Content]    Create question SP14+SP26
[Content]    Create question SP10+SP27
[Content]    Create question SP15+SP28
[Content]    Create question SP12+SP29
[Content]    Create question SP08+SP30
[Content]    Create question SP18+SP31
[Content]    Create question SP05+SP32
[Content]    Create question SP16+SP33
[Content]    Create question SP19+SP34
[Content]    Create question SP06+SP35
[Content]    Create question SP11+SP36
[Content]    Create question SP69+SP70
[Content]    Create question SP71+SP72
[Content]    Create question SP73+SP74
[Content]    Create question SP75+SP76
[Content]    Create question SP77+SP78
[Content]    Create question SP79+SP80
by SoSci Survey (328k points)
Okay, it seems you re-sent the page, and it seems that you have a large number of combined questions on the page. Is that correct?

Now ... please remove all this stuff, and just place the random generator on the page, and the PHP code to display the questions based (!) on what the random generator draws. Depending on whether you want to display the questions on one page, or one question per page you will use "for" or "loopPage()" in that code.

If you're unsure, just post the code that does not yet work.

Btw.: Which question ID does your random generator have?
by s243157 (150 points)
I have deleted everything, put in the Random Generator into the questionnaire and after that, a PHP code with the instruction:

$questions = valueList('SP81', NULL, 'label');
 
foreach ($questions as $identifier) {
  question($identifier);
}

The Random Generator has the ID SP81. One thing that worked is that now I see that everything is randomized: 20 questions are chosen randomly each time I open  the questionnaire so this is one step ahead - thank you.
Now the problem is that since questions are not combined (those which were), the questionnaire randomly chooses any kind of questions (originally, every question consisted of two parts: one scale (fully labeled) which is mandatory to answer and a free text input beside it which is optional. Is there a way to have the random generator draw out 20 questions which are combined?
I provide you with the link of the survey - I hope the hyperlink is still valid.

https://www.soscisurvey.de/da2023survey/?act=87DMirrExE5BMVO9si1u9t4S
by SoSci Survey (328k points)
Great, that's a good start. Now let's take care about the combinations.

As you have lots of combined questions, let's do it this way: First, write the combinations with a plus in the random generator, so change

SP02
SP03
SP09
SP17

into

SP02
SP03+SP23
SP09+SP24
SP17+SP25

Then we'll have to split that in the FOR loop:

foreach ($questions as $idList) {
  $questions = explode('+', $idList);
  question($questions);
}

Should that not work, replace question() by show(), please.
by s243157 (150 points)
Thank you!

Everything seems to be working smoothly now, plus I have come to understand how this should be implemented (I will be of course reading up on this to fully grasp the use of PHP codes.)

https://www.soscisurvey.de/da2023survey/?act=rP6w38iILzk088pJOFLaxfzS

In the other language versions, this randomization has also been automatically applied, although not being necessary. I assume that one option would be to remove the Randomization Generator from the questionnaire in these versions, or modify the input and make it draw 25 questions out of the total of 25 - although arguably this could probably be done more elegantly with the use of another PHP code. (In the present case the generator draws 11-12-13 questions in these.)
by SoSci Survey (328k points)
> In the other language versions, this randomization has also been automatically applied, although not being necessary.

Usually, you have one questionnaire for all languages. If you need variation per language, you can create a filter with getLanguage() - or you can create different questionnaires, but that may complicate the administration.

> or modify the input and make it draw 25 questions out of the total of 25

You would need a copy of the random generator for that, and some PHP code that makes sure to draw from the right generator. Please make sure to draw only from that generator that you're actually using, using question() for the random generator instead of dragging it into the questionnaire. Otherwise you risk the questions to be shown with different frequencies.
by s243157 (150 points)
Okay, so as I understand, I would have either of the two options as detailed above, and the former is seemingly a bit easier.

I have inserted the filter the following way:

if (getLanguage() == 'dan') {
$questions = valueList('SP81', NULL, 'label');
 
foreach ($questions as $idList) {
  $questions = explode('+', $idList);
  question($questions);
}}

One thing that seems to be missing is the instruction which concerns the other language versions; in the user guide I see that when applying /if/ it should be followed by /else/ with the instruction for the other versions.

What should be inserted here?
by SoSci Survey (328k points)
Your IF filter is a bit incomplete. First, you need to embed the random generator there via question. And then you need the ELSE part:

if (getLanguage() == 'dan') {
  question('SP81');
  $questions = valueList('SP81', NULL, 'label');
} else {
  question('SP82');
  $questions = valueList('SP82', NULL, 'label');
}

I guessed the ID of the other random generator. And make sure to drag neither SP81 nor the other one into the page.
by s243157 (150 points)
Okay, this is what the PHP code looks like now at this point:

if (getLanguage() == 'dan') {
  question('SP81');
  $questions = valueList('SP81', NULL, 'label');
 
foreach ($questions as $idList) {
  $questions = explode('+', $idList);
  question($questions);}
} else {
  question('SP82');
  $questions = valueList('SP82', NULL, 'label');
}

I have pulled out the two random generators from the page (but they are still shown to be on page no. 3 - I assume because of being mentioned in the PHP code.)

The Danish survey is functioning without any issues but the other versions do not show anything neither an error message nor questions. The debug information in the Swedish version for example shows this [Content]    Create question SP81
So the code should be correct as it chooses questions from SP82, the second random generator. Which should consequently mean that I made a mistake in what I put in SP82.

This is the content of the second random generator:

01 = SP03+SP23
02 = SP04+SP39
03 = SP05+SP32
04 = SP06+SP35
05 = SP07+SP40
06 = SP09+SP24
07 = SP10+SP27
08 = SP11+SP36
09 = SP12+SP29
10 = SP13+SP37
11 = SP14+SP26
12 = SP15+SP28
13 = SP16+SP33
14 = SP08+SP30
15 = SP17+SP25
16 = SP18+SP31
17 = SP19+SP34
18 = SP20+SP41
19 = SP21+SP38
20 = SP22+SP42
21 = SP43+SP44
22 = SP45+SP46
23 = SP47+SP48
24 = SP49+SP50
25 = SP51+SP52

Codes drawn per interview: 25

Type of drawing: equally distributed (draw without returning)
by SoSci Survey (328k points)
Well, no ... the else belongs to the IF, not to the foreach.

if (getLanguage() == 'dan') {
  question('SP81');
  $questions = valueList('SP81', NULL, 'label');
} else {
  question('SP82');
  $questions = valueList('SP82', NULL, 'label');
}
 
foreach ($questions as $idList) {
  $questions = explode('+', $idList);
  question($questions);
}
by s243157 (150 points)
All is working! And I think I get it now - a huge thank you for bearing with me, I am beyond grateful!

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

...