0 votes
in SoSci Survey (English) by s251320 (160 points)

Hello everyone!

I have a question regarding the random generator.
I designed a questionnaire, where I have 4 conditions (MQ01, MQ02, MQ03 and MQ04) and every participant is randomly assigned to one of the 4, to do that I created the following random generator:

if (value('RG01') == 1) {
  question('MQ01');
} elseif (value('RG01') == 2) {
  question('MQ02');
} elseif (value('RG01') == 3) {
  question('MQ03');
} elseif (value('RG01') == 4) {
  question('MQ04');
}

My problem is the following: If condition 4 occurs, I need to show an additional page in the introduction part (which is not shown in any other condition), and which I coded with the ID IN03, but I do not understand how to implement it in the generator, I tried like this, but it does not work:

if (value('RG01') == 1) {
  question('MQ01');
} elseif (value('RG01') == 2) {
  question('MQ02');
} elseif (value('RG01') == 3) {
  question('MQ03');
} elseif (value('RG01') == 4) {
  question('MQ04') and text (‘IN03’);
}

Could you please help me?

Thanks a lot :)

1 Answer

0 votes
by SoSci Survey (302k points)

To show both parts (on the same page), you would write boths functions one below the other, and close each with a semicolon.

if (value('RG01') == 1) {
  question('MQ01');
} elseif (value('RG01') == 2) {
  question('MQ02');
} elseif (value('RG01') == 3) {
  question('MQ03');
} elseif (value('RG01') == 4) {
  question('MQ04');
  text(‘IN03’);
}

yet, if your want them on separate pages, it's even easier. Remove the 'text()' function from page 2 and place this reduced filter on page 3.

if (value('RG01') == 4) {
  text(‘IN03’);
}

If the filter does not become active, nothing is shown, and SoSci Survey will just skip to the next page.

by s251320 (160 points)
Thank you very much! I need it on a different page, the problem is, I need it a few pages before MQ04 appears, not after the question (MQ04) is shown (IN03 is a definition I must show two pages before the question MQ04 is asked). By placing the reduced filter on page 3 I get it right after the question. Could you please help me to place it before? Thanks again
asked Jun 2, 2023 in SoSci Survey (English) by s251320 (160 points) Random Generator
by SoSci Survey (302k points)
> By placing the reduced filter on page 3 I get it right after the question.

Place it, wherever you like - just insert a new page there.
by s251320 (160 points)
I tried to place it on the page where the text should appear, but this error comes out: "The variable RG01 has not been asked on a previous page during this interview. Therefore value() cannot determine any answer, yet.", as the random generator is placed two pages after it, but if I place the random generator before, the question is again shown ahead the text, and that's what I'm trying to avoid...
by SoSci Survey (302k points)
> The variable RG01 has not been asked on a previous page during this interview

Make sure to start your test on the page that holds the random generator (or before). You can only use the value drawn by the random generator, if you give it the change to draw any value.

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

...