0 votes
in SoSci Survey (dt.) by s102985 (170 points)
edited by SoSci Survey

Bezugnehmend auf meine letzte Frage (https://support.soscisurvey.de/?qa=27646/mehrere-offene-antworten-ubernehmen), bräuchte ich noch einmal Unterstützung bei der Erstellung einer Matrix. Soweit funktioniert sie jetzt, allerdings geht die "trim"-Funktion noch nicht (Siehe Bild). Felder die in ME01 nicht ausgefüllt wurden, sollen in der Folgefrage nicht angezeigt werden. Können sie mir helfen?

Das ist mein PHP-Code:

$frage = 'ME01';
$items = array();
for ($i=1; $i<=10; $i++) {
  $itemID = id($frage, $i);
  $antwort = value($itemID);
  if (trim($antwort) != '') {
    replace('%text'.$i.'%', $antwort);
    $items[] = $i;
  }
}

// Folgefrage anzeigen
if (count($items) > 0) {
  question('ME05', 'combine=ME08','combine=ME09','combine=ME10','combine=ME11' ,'combine=ME12','combine=ME13','combine=ME14','combine=ME15','combine=ME16');
}

1 Answer

0 votes
by SoSci Survey (308k points)

Im Moment schränken Sie weder die Items (vertikal) noch die kombinierten Fragen (horizontal) ein, sondern rufen im question()-Befehl alles auf.

Versuchen Sie es mal hiermit:

$frage = 'ME01';
$items = [];
$fragenListe = [
  1 => 'ME05', 
  2 => 'ME08',
  3 => 'ME09'
  // u.s.w.
];
$fragen = [];
for ($i=1; $i<=10; $i++) {
  $itemID = id($frage, $i);
  $antwort = value($itemID);
  if (trim($antwort) != '') {
    replace('%text'.$i.'%', $antwort);
    $items[] = $i;
    $fragen[] = $fragenListe[$i];
  }
}

// Folgefrage anzeigen
if (count($items) > 0) {
  question($fragen, $items);
}
by s102985 (170 points)
Klappt!!! Vielen Dank! Sie haben mir sehr geholfen!

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

...