0 votes
in SoSci Survey (English) by s296958 (175 points)

Say I have several scales being looped on the same page using the following php code:

if (!isset($questions)) {
  $questions = getQuestions('AA');
  $questions_to_remove = ['AA08', 'AA10'];
  $questions = array_values(array_diff($questions, $questions_to_remove));
  if (value('SD10') == 10001) {
    debug("UNEMPLOYED");
    $questions_to_remove = ['AA03', 'AA04', 'AA13'];
    $questions = array_values(array_diff($questions, $questions_to_remove));
  }
  
  shuffle($questions);
  debug($questions);
  registerVariable($questions);
}

$questions = loopPage($questions);
question($questions);

I can't figure out how to change the code to implement the 2 attention checks (PR01) and 3 bogus items (PR02) such that they are shown seamlessly as regular items of the 'AA' scales. They already have the same question type (all questions are fully labelled scales) and the same Likert point labels etc.. I would really appreciate any tips on how to do this.

As a bonus, I also want to implement a data quality related open ended question (PR03) at the end of the page of a randomly chosen AA scale. If that's too difficult I'll just append it to one of the scales since their order in the loop will be shuffled anyway.

1 Answer

0 votes
by SoSci Survey (327k points)
selected by s296958
 
Best answer

The AA questions are scale batteries with multiple items? What about just adding the bogus items as regular items in these questions?

at the end of the page of a randomly chosen AA scale

You just need to decide (randomly) to which question to add it to. This could be look like this:

    ...
    shuffle($questions);
    $randomQuestion = $questions[0];
    shuffle($questions);
    debug($questions);
    registerVariable($questions);
    registerVariable($randomQuestion);
}

// Note, that you variable name must be $question, not $questions
$question = loopPage($questions);
question($question);
if ($question == $randomQuestion) {
  question('PR03');
}

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

...