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!