Hallo liebes Sosci-Survey-Team,
ich nutzen den Fragetyp Texteingabe mit Auswahlempfehlung, um den Befragten aus ca. 4000 Antwortalternativen 10 auswählen zu lassen. Diese 10 werden dann in den Folgefragen als Items angezeigt. Das funktioniert auch soweit.
Ich würde nur gerne zusätzlich verhindern, dass bei der Texteingabe mit Auswahlempfehlung Werte doppelt eingetragen werden können. Ich habe es schon mit folgendem Code versucht, aber das scheint nicht zu klappen:
$answers = getItems('A101', 'valid');
$answers2 = array_unique($answers);
if ((count($answers)) > (count($answers2))) {
repeatPage('A108');
}
Alternativ habe ich es mit valueList probiert, aber auch das funktioniert nicht:
$answers = valueList('A101');
$answers2 = array_unique($answers);
if ((count($answers)) > (count($answers2))) {
repeatPage('A108');
}
Können Sie mir hier weiterhelfen?
Vielen Dank!
Edit:
Ich habe jetzt folgende provisorische Lösung für mich gefunden, aber da gibt´s sicherlich elegantere Wege, oder? ;)
if (
((value('A101x1') != -9) and (value('A101x1') == value('A101x2'))) or
((value('A101x1') != -9) and (value('A101x1') == value('A101x3'))) or
((value('A101x1') != -9) and (value('A101x1') == value('A101x4'))) or
((value('A101x1') != -9) and (value('A101x1') == value('A101x5'))) or
((value('A101x1') != -9) and (value('A101x1') == value('A101x6'))) or
((value('A101x1') != -9) and (value('A101x1') == value('A101x7'))) or
((value('A101x1') != -9) and (value('A101x1') == value('A101x8'))) or
((value('A101x1') != -9) and (value('A101x1') == value('A101x9'))) or
((value('A101x1') != -9) and (value('A101x1') == value('A101x10'))) or
((value('A101x2') != -9) and (value('A101x2') == value('A101x3'))) or
((value('A101x2') != -9) and (value('A101x2') == value('A101x4'))) or
((value('A101x2') != -9) and (value('A101x2') == value('A101x5'))) or
((value('A101x2') != -9) and (value('A101x2') == value('A101x6'))) or
((value('A101x2') != -9) and (value('A101x2') == value('A101x7'))) or
((value('A101x2') != -9) and (value('A101x2') == value('A101x8'))) or
((value('A101x2') != -9) and (value('A101x2') == value('A101x9'))) or
((value('A101x2') != -9) and (value('A101x2') == value('A101x10'))) or
((value('A101x3') != -9) and (value('A101x3') == value('A101x4'))) or
((value('A101x3') != -9) and (value('A101x3') == value('A101x5'))) or
((value('A101x3') != -9) and (value('A101x3') == value('A101x6'))) or
((value('A101x3') != -9) and (value('A101x3') == value('A101x7'))) or
((value('A101x3') != -9) and (value('A101x3') == value('A101x8'))) or
((value('A101x3') != -9) and (value('A101x3') == value('A101x9'))) or
((value('A101x3') != -9) and (value('A101x3') == value('A101x10'))) or
((value('A101x4') != -9) and (value('A101x4') == value('A101x5'))) or
((value('A101x4') != -9) and (value('A101x4') == value('A101x6'))) or
((value('A101x4') != -9) and (value('A101x4') == value('A101x7'))) or
((value('A101x4') != -9) and (value('A101x4') == value('A101x8'))) or
((value('A101x4') != -9) and (value('A101x4') == value('A101x9'))) or
((value('A101x4') != -9) and (value('A101x4') == value('A101x10'))) or
((value('A101x5') != -9) and (value('A101x5') == value('A101x6'))) or
((value('A101x5') != -9) and (value('A101x5') == value('A101x7'))) or
((value('A101x5') != -9) and (value('A101x5') == value('A101x8'))) or
((value('A101x5') != -9) and (value('A101x5') == value('A101x9'))) or
((value('A101x5') != -9) and (value('A101x5') == value('A101x10'))) or
((value('A101x6') != -9) and (value('A101x6') == value('A101x7'))) or
((value('A101x6') != -9) and (value('A101x6') == value('A101x8'))) or
((value('A101x6') != -9) and (value('A101x6') == value('A101x9'))) or
((value('A101x6') != -9) and (value('A101x6') == value('A101x10'))) or
((value('A101x7') != -9) and (value('A101x7') == value('A101x8'))) or
((value('A101x7') != -9) and (value('A101x7') == value('A101x9'))) or
((value('A101x7') != -9) and (value('A101x7') == value('A101x10'))) or
((value('A101x8') != -9) and (value('A101x8') == value('A101x9'))) or
((value('A101x8') != -9) and (value('A101x8') == value('A101x10'))) or
((value('A101x9') != -9) and (value('A101x9') == value('A101x10')))
)
{
repeatPage('A108');
}