In the quota question, create a quota cell for each of the six product groups. The cell values should be one through six.
Each cell requires this qualification logic:
Begin Unverified Perl
my $productsList = 'productsList';
my $rankingQ = 'RankingQ';
my $quotaQ = 'QuotaQ';
my @groups = (
[1, 2, 3, 4], # first product group / quota cell has product 1, product 2, product 3, and product 4
[5, 6], # second product group / quota cell has product 5 and product 6
[7, 8, 9] # third product group / quota cell has product 7, product 8, and product 9
);
my $best = 0;
my $bestRank = 9999;
for (my $i = 1; $i <= LISTLENGTH($productsList); $i++) {
my $rank = GETVALUE($rankingQ . '_' . $i);
if ($rank < $bestRank) {
for (my $j = 1; $j <= scalar @groups; $j++) {
if ($i ~~ @groups[$j - 1]) {
if (ISQUOTACELLOPEN($quotaQ, $j)) {
$best = $j;
$bestRank = $rank;
}
last;
}
}
}
}
return $best == 1;
End Unverified
Line 2 must be updated with the name of the list of products. Lines 3 and 4 must be updated with the name of the ranking and quota question, respectively.
Lines 6-10 should be updated to reflect the nature of your product groups. As is, the code has three product groups: one with the first four products, one with the middle two, and one with the final three.
Finally, line 29 should be updated with each cell's cell value. So the first cell requires "$best == 1", the second requires "$best == 2", and so on.