0 votes
in SoSci Survey (English) by s192530 (125 points)

Hello,

I am trying to set a quota so that only 200 participants can complete my survey. I am not using online panel data (e.g., Qualtrics). I am sending the survey to a large demographic group with thousands of members. I want to cap the participants at 200.

I am trying to use a consent question as a screening question. If participants say "yes" (answer coded as 1) and consent to the survey, this counts towards my quota of 200.

I have tried re-creating this php code with no luck: https://www.soscisurvey.de/help/doku.php/en:survey:quota. I have tested it with much smaller quotas and it doesn't seem to do what I need it to.

I have set my limit for the answer "1" to 200 (that is if they consent to the survey) and for "2" to 1000 (that is if they don't consent, but the number doesn't really matter, because they won't take the survey).

If I have reached 200 participants, they are redirected to a different questionnaire in my project which says "we are no longer collecting data."

They answer the consent question on page 1 (i.e., "GT09").

I have put the following php code on pg.2:

$quotaPart = [ 1 => 200, 2 => 1000 ];
$Part = value('GT09');
$casesPart = statistic('count', 'A126_01', $Part);
if (!array_key_exists($Part, $quotaPart)) {
redirect('https://www.soscisurvey.de/affectatwork/?q=S0')
$maxPart = $quotaPart[$Part];
if($casesPart >= $maxPart) {
redirect('https://www.soscisurvey.de/affectatwork/?q=S0')
}

As per the instruction manual, I have also created an internal variable (A126) and used the following code at the bottom of page 2 to copy the quota characteristics:

$Part = value('GT09');
put('A126_01', $Part);
if ($Part <= 200) {
goToPage('PerpTP');
} else {
('https://www.soscisurvey.de/affectatwork/?q=S0');
}

Please let me know if you see any issues with my coding. No errors came up in debug mode, but it's not screening out when the quota is reached (I tried this with a quota less than 20 participants).

Any advice is greatly appreciated.

Thank you!

1 Answer

0 votes
by SoSci Survey (305k points)
selected by s192530
 
Best answer

The German version of the manual contains a simple code to have a quote on the completed questionnaires:

// Abgeschlossene Fragebögen zählen
$finished = statistic('count', 'FINISHED');
// Filter zum Quotenstopp
if ($finished >= 250) {
  // Text anzeigen
  text('QS01');
  // Weiter-Knopf ausblenden
  buttonHide();
  // Keine weiteren Inhalte dieser Seite zeigen
  pageStop();
}

If you want to count the "yes" responses, you need just a little modification:

$yeses = statistic('count', 'GT09', 2, true);
if ($yeses >= 200) {
  redirect('https://www.soscisurvey.de/affectatwork/?q=S0')
}

Use html() to show the counts for debugging:

$yeses = statistic('count', 'GT09', 2, true);
html('<p>You are respondent '.($yeses+1).'</p>');
by s192530 (125 points)
Thank you! This was a very simple fix! Much appreciated.

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

...