0 votes
in SoSci Survey (dt.) by s191910 (150 points)

Ich versuche für eine Skala einen Filter per PHP zu machen. Die Skala hat mehrere Items, wenn bei irgendeinem davon die Optionen 2-5 angewählt werden, soll auf der nächsten Seite eine bestimmte Frage angezeigt werden. So funktioniert es nicht:

if ((value('NU23_02') == 2) ||
(value('NU23_02') == 3) ||
(value('NU23_02') == 4) ||
(value('NU23_02') == 5)) {
question('NU24');
}
if ((value('NU23_03') == 2) ||
(value('NU23_03') == 3) ||
(value('NU23_03') == 4) ||
(value('NU23_03') == 5)) {
question('NU24');
}
if ((value('NU23_04') == 2) ||
(value('NU23_04') == 3) ||
(value('NU23_04') == 4) ||
(value('NU23_04') == 5)) {
question('NU24');
}
if ((value('NU23_05') == 2) ||
(value('NU23_05') == 3) ||
(value('NU23_05') == 4) ||
(value('NU23_05') == 5)) {
question('NU24');
}
if ((value('NU23_06') == 2) ||
(value('NU23_06') == 3) ||
(value('NU23_06') == 4) ||
(value('NU23_06') == 5)) {
question('NU24');
}
if ((value('NU23_07') == 2) ||
(value('NU23_07') == 3) ||
(value('NU23_07') == 4) ||
(value('NU23_07') == 5)) {
question('NU24');
}
if ((value('NU23_08') == 2) ||
(value('NU23_08') == 3) ||
(value('NU23_08') == 4) ||
(value('NU23_08') == 5)) {
question('NU24');
}
if ((value('NU23_09') == 2) ||
(value('NU23_09') == 3) ||
(value('NU23_09') == 4) ||
(value('NU23_09') == 5)) {
question('NU24');
}

Die Frage wird dann mehrmals angezeigt, das ist ja nichdt das GEwünschte. Wie machei ch das?

1 Answer

0 votes
by SoSci Survey (306k points)
edited by SoSci Survey

Ich vermute, die Skala geht bis 5, wir müssen uns also nicht um Werte >5 kümmern? Dann versuchen Sie es wie folgt:

if (count(getItems('NU23', '>', 1)) > 0) {
    question('NU24');
}

Die Funktion getItems() sucht die Items heraus, für welche Sie sich interessieren (Antwort > 1) und count() bestimmt, wie viele es sein.

by s191910 (150 points)
Gibt Fehlermeldung
by s191910 (150 points)
Warnung

Warnung: Unerwartetes Element: 1 - fehlt hier vielleicht ein Semikolon (;) oder Anführungszeichen?

if (count(getItems('NU23', '>' 1
by s191910 (150 points)
Leider verstehe ich nicht ,wie ich das Problem reparieren soll, die Meldung ist mir unklar
by SoSci Survey (306k points)
Pardon, ich hatte ein Komma vor der 1 vergessen. Ich habe das oben korrigiert.

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

...