0 votes
ago in SoSci Survey (dt.) by s123746 (155 points)

Hallo,

ich habe zwei Fragen bzgl. der Randomisierung von Items einer Frage über mehrere Seiten. Die Randomisierung und Anzahl klappt soweit.

  1. Es scheint das Speichern der Reihenfolge mit dem put() Befehl nicht zu funktionieren. Hier erhalte ich die folgende Warnung:

Please note that the random values created via random() or shuffle()
will not automatically be stored in the data set. If necessary, you
may use put() to store them.

  1. Ich erhalte folgende Fehlermeldung auf der letzten Seite mit Items, wenn ich den Fragebogen teste:

"One or more variables (A201_09, A201_36, A201_40, A201_07, A201_21,
A201_25, A201_04, A201_16, A201_02, A201_12, A201_37) have already
been asked on page 3. Please note that the answers from page 3 are
shown here and that they will be subsequently replaced. If you require
multiple similar questions, please create a copy of the question."

Mein Code lautet:

    if (!isset($itemsA201)) {
  $itemsA201 = getItems('A201', 'all');
  shuffle($itemsA201);
$itemsA201 = array_chunk($itemsA201, 11);
  registerVariable($itemsA201);
}
$i = loopPage(count($itemsA201));
question('A201', $itemsA201[$i]);
for ($i=0; $i<count($elements); $i++) {
    $id = id('IV01', $i + 1);
  put($id, $elements[$i]);
}

Wie kann ich sicherstellen, dass die Reihenfolge gespeichert wird und dass die Items nur einmal angezeigt und beantwortet werden können?
Vielen Dank!

1 Answer

0 votes
ago by SoSci Survey (325k points)

Please note that the random values created via random() or shuffle()
will not automatically be stored

Das ist nur ein Hinweis, der unabhängig von der Speicherung angezeigt wird.

"One or more variables (A201_09, A201_36, A201_40, A201_07, A201_21,
A201_25, A201_04, A201_16, A201_02, A201_12, A201_37) have already
been asked on page 3.

Wird die Frage A201 mehrfach angezeigt? Diese Fehlermeldung erscheint meistens, wenn man die Frage in eine Seite zieht und (!) sie zusätzlich per question() einbindet. Ob das in Ihrem Fall zutrifft, kann ich auf Basis Ihrer Frage nicht abschätzen.

ago by s123746 (155 points)
Vielen Dank für die Antwort. Die Reihenfolge scheint dennoch nicht im Datensatz gespeichert zu werden.

Die Frage habe ich nicht zusätzlich eingebunden. Auf der Seite ist lediglich noch ein Textfeld, das eine Definition enthält, ansonsten nur der PHP-Code wie oben beschrieben.
Ja, einige Items doppeln sich über die Seiten hinweg.

Dazu erscheint jetzt auch noch die Fehlermeldung:
There is an error in the PHP code:
Questionnaire Error: Undefined variable $elements
line: 11

PHP code

008 }
009 $i = loopPage(count($itemsA201));
010 question('A201', $itemsA201[$i]);
011 for ($i=0; $i<count($elements); $i++) {
012     $id = id('IV01', $i + 1);
013   put($id, $elements[$i]);
014 }
Questionnaire Error: count(): Argument #1 ($value) must be of type Countable|array, null given
line: 11

PHP code

008 }
009 $i = loopPage(count($itemsA201));
010 question('A201', $itemsA201[$i]);
011 for ($i=0; $i<count($elements); $i++) {
012     $id = id('IV01', $i + 1);
013   put($id, $elements[$i]);
014 }

Haben Sie eine Idee, wie ich das beheben kann?
ago by SoSci Survey (325k points)
>  count(): Argument #1 ($value) must be of type Countable

In der Tat haben Sie die Variable $elements nirgend definiert. Bitte ändern Sie

for ($i=0; $i<count($elements); $i++) {
  $id = id('IV01', $i + 1);
  put($id, $elements[$i]);
}

Wie folgt:

$id = id('IV01', $i + 1);
put($id, $itemsA201[$i]);

> Ja, einige Items doppeln sich über die Seiten hinweg.

Das sollte nicht passieren, aber um das zu lösen, bräuchten wir noch ein wenig mehr Debug-Information:

debug($itemsA201);

Am besten posten Sie die Debug-Information von unterschiedlichen Wiederholungen im selben Interview.
ago by s123746 (155 points)
Dankeschön, die Änderung habe ich vorgenommen. Hier die Informationen:

[Information]    Interview started (new case no. 51)
[Information]    Questionnaire base from project dfow will be used
[Processing]    Create page 3 in questionnaire base
[Content]    Create question A202
[Information]    loopPage() will now repeat page 3 for 4 times, starting with value 0
[Content]    Create question A201
debug()    Content:
[0]    [0]19    [1]10    [2]3    [3]5    [4]41    [5]39    [6]21    [7]29    [8]23    [9]36    [10]24
[1]    [0]9    [1]22    [2]27    [3]8    [4]18    [5]38    [6]15    [7]40    [8]6    [9]20    [10]28
[2]    [0]2    [1]35    [2]32    [3]31    [4]14    [5]13    [6]37    [7]34    [8]16    [9]17    [10]25
[3]    [0]1    [1]12    [2]7    [3]26    [4]4    [5]42    [6]33    [7]30    [8]11

--

[Information]    Interview started (new case no. 52)
[Information]    Questionnaire base from project dfow will be used
[Processing]    Create page 3 in questionnaire base
[Content]    Create question A202
[Information]    loopPage() will now repeat page 3 for 4 times, starting with value 0
[Content]    Create question A201
debug()    Content:
[0]    [0]5    [1]7    [2]2    [3]41    [4]15    [5]8    [6]31    [7]40    [8]4    [9]17    [10]27
[1]    [0]20    [1]6    [2]28    [3]10    [4]9    [5]19    [6]14    [7]1    [8]39    [9]37    [10]24
[2]    [0]29    [1]42    [2]26    [3]3    [4]25    [5]36    [6]18    [7]21    [8]35    [9]11    [10]34
[3]    [0]13    [1]23    [2]30    [3]38    [4]12    [5]16    [6]32    [7]22    [8]33

---

[Information]    Interview started (new case no. 53)
[Information]    Questionnaire base from project dfow will be used
[Processing]    Create page 3 in questionnaire base
[Content]    Create question A202
[Information]    loopPage() will now repeat page 3 for 4 times, starting with value 0
[Content]    Create question A201
debug()    Content:
[0]    [0]24    [1]16    [2]30    [3]27    [4]18    [5]26    [6]6    [7]28    [8]5    [9]17    [10]13
[1]    [0]2    [1]32    [2]11    [3]42    [4]9    [5]14    [6]25    [7]38    [8]1    [9]22    [10]8
[2]    [0]33    [1]36    [2]35    [3]31    [4]7    [5]19    [6]10    [7]39    [8]20    [9]41    [10]37
[3]    [0]4    [1]40    [2]12    [3]15    [4]23    [5]21    [6]29    [7]3    [8]34
ago by SoSci Survey (325k points)
Danke. Ich meinte allerdings zwei Debug-Codes aus demselben Interview - also noch zusätzlich zu ersten jene, die nach dem Klick auf "Weiter" angezeigt wird. Ich will prüfen, ob die Abfolge gleich bleibt, um mögliche Ursachen für die doppelte Anzeige von Items zu erkennen.

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

...