This can be done, but it'll take a bit of setup.
First, create a quota question. It needs to have twelve cells with cell values 1 through 12. Each cell can be set to always qualify with some large limit like 99999. The question the quota should skip to if disqualified can be any question in the survey. Now copy-and-paste this quota question so that you have three of them.
Place the three quota questions on some page after the terminate questions of your survey. We don't want respondents to actually land on these questions while taking the survey.
Now you can create your constructed list. Its parent list should be the list of twelve items. Its instructions should be this:
Begin Unverified Perl
# Parameters
my $plist = 'list1';
my $gridQ = 'GridQ';
my @quotaQs = ('QuotaQ1', 'QuotaQ2', 'QuotaQ3');
# Run
my @contestants = ();
my $bestCompletes = 9999999;
for (my $item = 1; $item <= 9; $item++) {
if (GETVALUE($gridQ . '_r' . $item) <= 3) {
my $completes = getTotalQuotaCellCompletes($item);
if ($completes < $bestCompletes) {
@contestants = ($item);
$bestCompletes = $completes;
}
elsif ($completes == $bestCompletes) {
push(@contestants, $item);
}
}
}
for (my $item = 10; $item <= 12; $item++) {
if (GETVALUE($gridQ . '_r' . $item) <= 4) {
my $completes = getTotalQuotaCellCompletes($item);
if ($completes < $bestCompletes) {
@contestants = ($item);
$bestCompletes = $completes;
}
elsif ($completes == $bestCompletes) {
push(@contestants, $item);
}
}
}
my $added = 0;
for (my $item = 10; $item <= 12; $item++) {
for (my $i = 0; $i < scalar @contestants; $i++) {
if ($contestants[$i] == $item) {
ADD($plist, $item);
SETVALUE($quotaQs[$added], $item);
splice(@contestants, $i, 1);
$added++;
last;
}
}
}
while ($added < 3 && scalar @contestants > 0) {
my $index = RANDNUM(RESPNUM(), 0, scalar @contestants - 1);
my $item = $contestants[$index];
ADD($plist, $item);
SETVALUE($quotaQs[$added], $item);
splice(@contestants, $index, 1);
$added++;
}
SORTBYVALUE();
sub getTotalQuotaCellCompletes {
my ($item) = @_;
my $completes = 0;
foreach my $quotaQ (@quotaQs) {
$completes += QUOTACELLCOMPLETES($quotaQ, $item);
}
return $completes;
}
End Unverified
Line 3 must be updated with the name of the parent list, line 4 must be updated with the name of the grid question, and line 5 must be updated with the names of the three quota questions.
Please test thoroughly.