0 votes
in SoSci Survey (English) by s257096 (110 points)

Dear all,

I have an issue. In my study, the participant is provided with 10 randomly selected "Yes/No" questions from 159, all of which are located in the section "YN". If the participant answers "Yes" he is provided with another page, if "No" then this page is hidden.

E.g. Page 1:
1. Id YN001 -> yes
2. Id YN005 -> no
3. Id YN008 -> no
.
.
.
10. id YN020 -> yes

Then the next pages are: B1, ..., B20.

For randomization, I used the following PHP code:

  if (!isset($fragen)) {
  // Liste aller Fragen aus Rubrik YN
  $fragen = getQuestions('YN');
  // Die Liste der Fragen (Array) mischen und zwischenspeichern
  shuffle($fragen);
  registerVariable($fragen);
}


// Alle Kennungen aus der Liste $fragen abarbeiten
//$frage = loopPage($fragen);

// PHP-Code später im Fragebogen
$randomQuestions = array_slice($fragen, 0, 10);

foreach ($randomQuestions as $questionID) {
  question($questionID);
}

But doesn´t matter which filters I try to use through PHP code or integrated into the questions, the participant still sees all the pages of the questions that were not shown in the set of 10 (so those that he didn´t answer Yes or No (149 left)).

How can I fix it?

Thank you in advance.

by s257096 (110 points)
We are talking about 159 pages with the same 5 questions.

I am evaluating (159) software metrics. I am asking the participant, on one page 02 about 10 randomly selected metrics:
1. Do you know the metric "X"  ?
2. Do you know the metric "Y"  ?
.
.
.
10. Do you know the metric "Z" ?


if the participant answers "Yes", then the page with 5 more questions about this metric should be displayed. So if the participant answers all 10 yes/No questions "Yes", then 10 more pages with similar 5 questions (just the name of the metric is different) are displayed.
by SoSci Survey (305k points)
Okay, you should definitely take a look at this feature:
https://www.soscisurvey.de/help/doku.php/en:create:multilevel

Form a technical point of view, it's absolutely not sensible to have 100 and more copies of the same content. This would also be hell in data analysis.
by s257096 (110 points)
But the content is not the same, the questions are the same but they are about different metrics, meaning, that answers will be different. Checking the feature now will write you if still face problems. Thank you
by SoSci Survey (305k points)
>  the questions are the same but they are about different metrics,

That's the idea of a multi-levle structure: You ask the same questions about different simuli (like metrics).
by s257096 (110 points)
Hello again! I tried to dive deep in the information that you recommended:
https://www.soscisurvey.de/help/doku.php/en:create:multilevel

I think for me would be suitable the usage of the randomUse() function. But nothing still works properly, please help.

This is my Randomization generator:

$questions = valueList('ZE26', NULL, 'label');
 
foreach ($questions as $identifier) {
  question($identifier);
}

On the next page after it of the main questionnaire:

$codes = array_values(valueList('ZE26'));
$i = loopToPage('subStart', count($codes));
multiLevelDown('sub01', $codes[$i]);
// Specify that the ballots are not automatically stored.
randomUse('ZE26', array());

I created subquetionnaire: with page "subStart", that has to be looped.

For me still not clear:
1. How not only to loop page 10 times (number of provided "Yes/No" question), but also remove amount of loops, when the participant answered "No"
2. How to show the participant the questions about the particular metric, so how to specify which questions should appear on the loop pages, according to the Yes answers from the page 02.

Please, provide me with some PHP-code samples, I can work with. I went with it through hell for the last 3 days.

I am coping the explanation of my survey again, if this is needed:
We are talking about 159 pages with the same 5 questions.

I am evaluating (159) software metrics. I am asking the participant, on one page 02 about 10 randomly selected metrics:
1. Do you know the metric "X"  ?
2. Do you know the metric "Y"  ?
.
.
.
10. Do you know the metric "Z" ?


if the participant answers "Yes", then the page with 5 more questions about this metric should be displayed. So if the participant answers all 10 yes/No questions "Yes", then 10 more pages with similar 5 questions (just the name of the metric is different) are displayed. Main problem with the usual filters was, that if question was not shown at all (filtered out by randomization), the value() wan not identified, and the filters didn´t work.

1 Answer

0 votes
by SoSci Survey (305k points)

You're using several mechanisms, let's go through them:

foreach ($questions as $identifier) {
  question($identifier);
}

This will show the drawn questions on one page. Probably your yes/no question?

$i = loopToPage('subStart', count($codes));

This will repeat pages within the current record. What is the ID of the page with the PHP code, and where is subStart located, relative to this page?

multiLevelDown('sub01', $codes[$i]);

This is the multi level part.

  1. How not only to loop page 10 times (number of provided "Yes/No" question), but also remove amount of loops, when the participant answered "No"

Skip to the next page, using a filter. For example:

$codes = array_values(valueList('ZE26'));
$i = loopToPage('subStart', count($codes));
// Which yes/no question?
$qstID = $codes[$i];
if ($value($qstID) == 2) {
  multiLevelDown('sub01', $codes[$i]);
} else {
  goToPage('next'); 
}
  1. How to show the participant the questions about the particular metric

Depends ... let's say, its name is stored as question text in the yes/no question:

$codes = array_values(valueList('ZE26'));
$i = loopToPage('subStart', count($codes));
// Which yes/no question?
$qstID = $codes[$i];
// Get the text
$qstText = getItemtext($qstID, 'question');
// Give both information to the subordinate questionnaire
multiLevelDown('sub01', [
  'id' => $qstID,
  'label' => $qstText
]);

You'll have to use multiLevelData() in the other questionnaire to get and use the data, for example for a placeholder.

I went with it through hell for the last 3 days.

Take a look into the debug information often, add debug()whenever you're not sure if a PHP variable has the proper content, for example:

// Get the text
$qstText = getItemtext($qstID, 'question');
debug($qstText);

I went with it through hell for the last 3 days.

It will paid out :)

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

...