0 votes
in Methoden-Fragen by s135647 (135 points)

Hello,

I am trying to create a survey where on Page A participants have to choose a number on a slider between -3 and 3.

Then the computer draws a random number between -3 and 3 and the participant is informed of that draw.

Finally, depending on if the number drawn by the computer is smaller or equal to the number chosen by the participant, she gets exposed to Page B otherwise, if the number drawn by the computer is larger than the one chosen by the participant, she gets exposed to page C.

I know how to make the participants chose their number on a slider, but I don't find how to have the computer draw, inform the participant of the draw and select the next page based on the two conditions.

Thank you very much in advance for your help.

1 Answer

0 votes
by SoSci Survey (298k points)

I would recommend a "random generator" for drawing the number. It's advantage is that you have the result automatically stored in the dataset.

Let's say your slider item (differentiation 1 to 7) hat the ID SL01_01 and the random generator (with 7 codes from 1 to 7) has the ID RG01. Here's the code to inform the respondents:

$num = value('RG01') - 4;
// Need a plus or minus
$numS = return sprintf("%+d",$num);
replace('%yourNumber%', $numS);

Of course, you have to use the placeholder in your text that is displayed to the respondent.

And here's the code to compare the numbers:

if (value('RG01') <= value('SL01_01')) {
  setPageOrder('pageB', 'pageD');
} else {
  setPageOrder('pageC', 'pageD');
}

Of course, it's probably better to display different contents on one combined page BC instead of using setPageOrder(). Yet, both will work.

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

...