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 SoSci Survey (312k points)
I would recommed using a random generator instead of shuffle(), if it's in any kind relevant to show the questions similarly often.

You PHP code above seems to contain not filter to decide which pages to show. How did you configure that?
by s257096 (110 points)
I tried to use a random generator, but it could generate randomly only questionnaires but not the questions.

I settled filters within each YN question, e.g if YN01 answer is Yes -> display B1 page. But it doesn´t work in case if question, e.g. YN01 was not shown to the participant as it was not selected by random.
by SoSci Survey (312k points)
> I tried to use a random generator, but it could generate randomly only questionnaires but not the questions.

The random generator only draws (numeric) codes, eventually connected to text labels. What you do with those codes, is up to you. Using valueList() below the random generator will, for example, return you a list similar to what you have in $fragen.

For directions, please read https://www.soscisurvey.de/help/doku.php/en:create:rotation-questions

> I settled filters within each YN question, e.g if YN01 answer is Yes -> display B1 page. But it doesn´t work in case if question, e.g. YN01 was not shown to the participant as it was not selected by random.

The filters configures in questions only become active if the question is shown in the questionnaire. If not, it won't be shown. Please use PHP filters or - as you have many questions - better somd PHP array that defines what follow-up questions to display under what conditions.
by s257096 (110 points)
> The filters configures in questions only become active if the question is shown in the questionnaire. If not, it won't be shown. Please use PHP filters or - as you have many questions - better somd PHP array that defines what follow-up questions to display under what conditions.

Can you show an example of how to do this or put the link on the instructions?
by SoSci Survey (312k points)
There are various possible solutions. You have 159 filter questions. How many questions do you have that are affected by these filters, and how do they relate?
by s257096 (110 points)
edited by s257096
On page "YesNo" of the questionnaire I provide 10 randomly selected questions out of 159.
Each such question has another pair page that has to be shown in case of the answer "Yes".
E.g.  If the participant answers "Yes" to a question e.g. YN01 then next page he/she sees will be B1

If the user answers "Yes" to few questions, e.g. YN01, YN05, then newt pages displayed will be B1, B5 one by one. (so the user will not see pages B2,B3,B4, B6,....,B159).

The main question is how to apply the PHP filter if the value() is not identified because the question was skipped by the randomization.
by s257096 (110 points)
The Random generator worked easily and well! Thank you for the advice, don´t know why I could not find this way before. So now I have 10 random questions per page, just need to find a solution for the filters. Very much hope for your help.
by SoSci Survey (312k points)
> Each such question has another pair page that has to be shown in case of the answer "Yes".

How many pages are we talking about: 2x10 or 2x159 ? And what exactly do these pages contain? Is their structure always the same?
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 (312k 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 (312k 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 (312k 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

...