0 votes
in SoSci Survey (English) by s083051 (140 points)

Hello, I received this strange message error reporting a mistake in the code that I do not have

I am wondering if you could help me.

Thanks in advance,
Best,
Laure.

by s083051 (140 points)
Ok, so yes, I have a variable called SD01 (2 answers possible, 1 = man, 2 = woman), and running the debug starting at this page seems ok.
by SoSci Survey (302k points)
This means, everything is okay now? If not (the $round error still appears), please start at SD01, and then post the debug information from the filter page. Thanks.
by s083051 (140 points)
No it still doesn't work, the message error appears after the slide asking the age and gender:

This message appears:

Im PHP-Code trat ein Fehler auf.

Fehler im Fragebogen: Die PHP-Variable $round wurde verwendet, in diesem PHP-Code aber noch nicht definiert (sie enthält noch keinen Wert).

PHP-Code

026 if ((value ('SD01') == 1) and ((45 < value('SD02_04')) and (value('SD02_04') < 56)))
027 {$round = urnDraw('manold', 'IV03');}
028
029 if ($round > 25) {{
030   redirect(
031 'https://mingle.respondi.com/s/904217/ospe.php3?c_0002=2&return_tic=%tic%
032 ');
by SoSci Survey (302k points)
As I wrote (a few times by now), I'll need the debug information (just copy it from the page and post it here) to solve the issue.

> appears after the slide asking the age and gender:

We're talking about the next page, after you clicked "next", right? If it appears on the same page, you'll have to move your PHP code to the next page (it must be on the page *after* the questions SD01/SD02).
by s083051 (140 points)
Here is the debug information from the page with the questions (age and gender):
[Information]    Interview gestartet (neue Nummer 583)
[Information]    Der Fragebogen Pilot_LB im Projekt plb wird verwendet
[Verarbeitung]    Erstelle Fragebogen-Seite Nr. 4
[Inhalt]    Erstelle Frage SD01
[Inhalt]    Erstelle Frage SD02
[Inhalt]    Erstelle Frage SD03
[Inhalt]    Erstelle Frage SD04
[Inhalt]    Erstelle Frage SD05
[Inhalt]    Erstelle Frage SD06
[Inhalt]    Erstelle Frage SD09

And here is the debug information for the following page:

[Information]    Interview Nummer 583 wird fortgesetzt
[Information]    Der Fragebogen Pilot_LB im Projekt plb wird verwendet
[Verarbeitung]    Lese Antworten von Seite 4
[Information]    Die Verweildauer auf Seite 4 war 121 Sekunden
[Information]    Keine Antwort für SD01
[Information]    In der Frage SD01 fehlt eine erforderliche Antwort
[Information]    Keine Antwort für SD02_01
[Information]    Keine Antwort für SD02_02
[Information]    Keine Antwort für SD02_03
[Information]    Keine Antwort für SD02_04
[Information]    In der Frage SD02 fehlt eine erforderliche Antwort
[Information]    Keine Antwort für SD03
[Information]    In der Frage SD03 fehlt eine erforderliche Antwort
[Information]    Keine Antwort für SD04
[Information]    Keine Antwort für SD04_01
[Information]    In der Frage SD04 fehlt eine erforderliche Antwort
[Information]    Keine Antwort für SD05
[Information]    Keine Antwort für SD05_07
[Information]    In der Frage SD05 fehlt eine erforderliche Antwort
[Information]    Antwort auf SD06_01 = 1
[Information]    Keine Antwort für SD06_01a
[Information]    Antwort auf SD06_02 = 1
[Information]    Antwort auf SD06_03 = 1
[Information]    Keine Antwort für SD06_03a
[Information]    Antwort auf SD06_04 = 1
[Information]    Keine Antwort für SD06_04a
[Information]    Antwort auf SD06_05 = 1
[Information]    Keine Antwort für SD06_05a
[Information]    Antwort auf SD06 = 0
[Information]    In der Frage SD06 fehlt eine erforderliche Antwort
[Information]    Keine Antwort für SD09_01
[Information]    Keine Antwort für SD09_02
[Information]    In der Frage SD09 fehlt eine erforderliche Antwort
[Information]    Fragen bisher zu 0% vollständig beantwortet
[Verarbeitung]    Erstelle Fragebogen-Seite Nr. 5
[Information]    value("SD02_04") = ""
[Information]    value("SD02_04") = ""
[Information]    value("SD01") = -9
[Information]    value("SD01") = -9
[Information]    value("SD01") = -9
[Information]    value("SD01") = -9
[Information]    value("SD01") = -9
[Information]    value("SD01") = -9
[Information]    value("SD06_01") = 1
[Information]    value("SD06_02") = 1
[Inhalt]    Erstelle Frage SD07

Yes, the message error appears after I clicked next. the code is at the right place.

1 Answer

0 votes
by SoSci Survey (302k points)

Thanks for the debug information. According to this information, both, the question SD01 and the PHP code are located on page 4.

This won't work, because SoSci Survey will first create the question SD01, then run the PHP-filter (not finding an answer for SD01 so far), and then send this to the respondent. The response to SD01 is not available before page 5.

This is the most common error when creating filters, and easy to solve: Just drag the PHP code to page 5 (at the very beginning of page 5).

To explain the error message: As you have not any answer so far, the function value() gives you a void result or - as you have re-sent the (non-)answer - the errro code -9:

value("SD01") = -9

None of your IF filters will respond to SD01=-9, because they all expect either 1 or 2, which is fine, as you demand a response. This, in turn, means that the PHP variable $round will not be set in any of these IF filters. Therefore, SoSci Survey tells you that $round has not be defined.

by s083051 (140 points)
And, no, the PHP code was already in page 5, right after the page were are asked the gender and the age. I re-created a page, copy paste the code and deleted the previous page. I still have the message error.
by s058368 (110 points)
Lieber Herr Leiner,

ich arbeite in diesem Projekt mit und habe mich ebenfalls mit diesem Problem beschäftigt.

Es scheint so, dass diese Fehlermeldung nur dann auftaucht, wenn eine Person mit unzulässigem Alter den Fragebogen bearbeitet (Alter unter 25 oder über 56). Personen im richtigen Alter (bei denen jeweils die $count-Variablen und die Urnenziehung spezifiziert wurden) können sich normal durchklicken.

Könnte Ihnen diese Information weiterhelfen?

Viele Grüsse,
Brian Cardini
by SoSci Survey (302k points)
Ich hatte gehofft, dass ich die Ursache des Fehlers oben bereits ausführlich dargelegt hätte - inklusive zweitere Änderungen (PHP-Code auf die richtige Seite und korrekter Altersvergleich beim ersten IF), welche es beheben sollten.

Wenn das Problem noch nicht gelöst ist, würde ich Sie bitten, dass Sie eine neue Frage anlegen ("related question", hier wird's langsam unübersichtlich), dort den aktuell verwendeten PHP-Code posten und die Debug-Information der betroffenen Seite. Stellen Sie bitte auch sicher, dass der PHP-Code auf der Seite *nach* der Seite mit SD01 und SD02 steht.
by s058368 (110 points)
Wir haben mittlerweile die Lösung gefunden.

Wir mussten den Code für den Ausschluss von Personen mit einem bestimmten Alter (SD02_04 = Alter in Jahren) anpassen von:

if ((value('SD02_04') <= 24) and (value('SD02_04') >= 56)) {redirect(
'http://mingle.respondi.com/s/904217/ospe.php3?c_0002=0&return_tic=%tic%
');}

zu

if ((value('SD02_04') <= 24) or (value('SD02_04') >= 56)) {redirect(
'http://mingle.respondi.com/s/904217/ospe.php3?c_0002=0&return_tic=%tic%
');}

Viele Grüsse und besten Dank für die schnellen Rückmeldungen,
Brian Cardini

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

...