0 votes
in SoSci Survey (dt.) by s212490 (190 points)
edited by SoSci Survey

Ich möchte die Anzahl der richtigen Antworten der Vp erfassen. Dazu habe ich folgenden Code genutzt.
Ich habe zunächst die richtigen Antworten definiert. Die Frage ist vom Typ "Lückentext offen"

// Definition der Fragen und der korrekten Antworten
$fragen = [
  'ZE06_01' => 18,  
  'ZE07_01' => 60,  
  'ZE08_01' => 5,  
  'ZE09_01' => 17,
  'ZE10_01' => 8,
  'ZE11_01' => 29,
  'ZE12_01' => 5,
  'ZE13_01' => 13,
  'ZE14_01' => 21,
  'ZE15_01' => 51,
];
// Initialisierung einer Zähler-Variable
$points = 0;
 
// Prüfung aller Fragen in einer Schleife
foreach ($fragen as $variable=>$correct) {
  if (value($variable) == $correct) {
    $points++;
  }
}

// ... oder in einer internen Variable speichern
put('IV_01', $points);

Ich habe bereits eine Frage vom Typ "interne Variable" erstellt und dort "IV_01" definiert. In der Variablenübersicht wird mir "IV_01" nicht in der Liste der internen Variablen präsentiert, sondern weiter unten bei den regulären Items. Auch wird mir bei den erhobenen Daten noch nicht angezeigt, wie viele Antworten richtig beantwortet wurden.
Habe ich die interne Variable also nicht richtig eingerichtet? Wenn nein, wie kann ich das richtig machen?

1 Answer

+1 vote
by SoSci Survey (304k points)

Ich habe bereits eine Frage vom Typ "interne Variable" erstellt und dort "IV_01" definiert.

Dann schreiben Sie den Wert von $points doch mal in diese Variable:

put('IV_01', $points);

Stellen Sie bitte sicher, dass der Variablennamen "IV_01" korrekt ist. SoSci Survey wird einen solchen Namen nicht vergeben, aber falls Sie die Variable umbenannt haben, kann er durchaus korrekt sein.

by SoSci Survey (304k points)
Bitte posten Sie die vollständige Debug-Information von rechts oben (https://www.soscisurvey.de/help/doku.php/de:create:debugging). Danke.
by s212490 (190 points)
Die Variablen sind aber auf Seite 16. Dort sind die Fragen mit der genauen Bezeichnung
by s212490 (190 points)
Seite 16 mit den Fragen:
[Information]    Interview number 314 is to be continued
[Information]    Questionnaire Expra from project tutorial307944 will be used
[Information]    Retention period on page 18 has been 47 seconds
[Processing]    Reading answers from page 17+18
[Information]    Answer missing for SC06_01
[Information]    0% of the questions have been answered so far
[Processing]    Create page 16 in questionnaire Expra
[Content]    Create question A106
[Content]    Create question A107
[Content]    Create question A108
[Content]    Create question A109
[Content]    Create question A110
[Content]    Create question A111
[Content]    Create question A112
[Content]    Create question A113
[Content]    Create question A114
[Content]    Create question A115
[Information]    The following placeholders have been prepared:
%remain% = (text) 238

Seite 17 mit PHP-Code:
[Information]    Interview number 314 is to be continued
[Information]    Questionnaire Expra from project tutorial307944 will be used
[Information]    The retention period on page 16 has been additional 32 seconds
[Processing]    Reading answers from page 16
[Information]    Ignore A106 failed (omit after probing)
[Information]    Answer missing for A106
[Information]    Ignore A107 failed (omit after probing)
[Information]    Answer missing for A107
[Information]    Ignore A108 failed (omit after probing)
[Information]    Answer missing for A108
[Information]    Ignore A109 failed (omit after probing)
[Information]    Answer missing for A109
[Information]    Ignore A110 failed (omit after probing)
[Information]    Answer missing for A110
[Information]    Ignore A111 failed (omit after probing)
[Information]    Answer missing for A111
[Information]    Ignore A112 failed (omit after probing)
[Information]    Answer missing for A112
[Information]    Ignore A113 failed (omit after probing)
[Information]    Answer missing for A113
[Information]    Ignore A114 failed (omit after probing)
[Information]    Answer missing for A114
[Information]    Ignore A115 failed (omit after probing)
[Information]    Answer missing for A115
[Information]    0% of the questions have been answered so far
[Processing]    Create page 17 in questionnaire Expra
[Information]    value("A106_01") = ???
[Information]    value("A107_01") = ???
[Information]    value("A108_01") = ???
[Information]    value("A109_01") = ???
[Information]    value("A110_01") = ???
[Information]    value("A111_01") = ???
[Information]    value("A112_01") = ???
[Information]    value("A113_01") = ???
[Information]    value("A114_01") = ???
[Information]    value("A115_01") = ???
[Information]    The internal variable IV04_01 gets a value of 0.
[Information]    No visible content on this page, continue with page 18
[Processing]    Create page 18 in questionnaire Expra
[Content]    Create question SC06
[Information]    The following placeholders have been prepared:
%remain% = (text) 238
by SoSci Survey (304k points)
Laut Debug-Information wurden die Fragen alle nicht beantwortet (obwohl der Fragebogen nachgehakt hatte).

> [Information]    Ignore A106 failed (omit after probing)
> [Information]    Answer missing for A106
> [Information]    Ignore A107 failed (omit after probing)
> [Information]    Answer missing for A107

Ach ja, falls es sich um Dropdowns handelt (?), heißen die Variablen A106 und nicht A106_01 (etc.).
by s212490 (190 points)
Danke! Jetzt funktioniert alles. Ich musste die Variablen lediglich ohne "_01" definieren.

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

...