Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Least fill quota with priority

I need to emply a least fill quota.  I have a question with 20 options where respondents can check all of the firms they are aware of. In subsequent questions, I need to create a list based on the firms they are aware of that does the following: 1) employes least fill quota 2) prioritizes certain firms 3) has a list max of 8.

I have tried following least fill quota solutions on other pages of the forum, but can't figure out how to adapt to the fact that respondents will be put into up to 8 of the quota categories.

Thanks in advance
asked Jan 24, 2019 by Hannah

1 Answer

0 votes
The Community Question Library has a tool for least fill-style quota questions, but not for a quota question in which a respondent can qualify for multiple cells.  We'll need to do something special for that.

Start by creating a single quota question.  Its name should follow the formula of "(base name) + 1."  The quota cell's value should be 1 and its cell limit should be whatever you want the limit to be for this checkbox.  Then give the cell this qualification logic:

Begin Unverified Perl
# Parameters
my $selectName = 'SelectQ';
my $quotaBaseName = 'QuotaQ';
my $numberOfQuotas = 8;
my $maxEntriesPerRespondent = 4;

my $thisQuota = 1;

# Run
if (!GETVALUE($selectName . '_' . $thisQuota)) {
    return 0;

for (my $i = 1; $i < $thisQuota; $i++) {
    if (GETVALUE($quotaBaseName . $i) == 1) {
        if ($maxEntriesPerRespondent == 0) {
            return 0;

my $thisFill = QUOTACELLCOMPLETES($quotaBaseName . $thisQuota, 1) / QUOTACELLLIMIT($quotaBaseName . $thisQuota, 1);
for (my $i = $thisQuota + 1; $i <= $numberOfQuotas; $i++) {
    if (GETVALUE($selectName . '_' . $i)) {
        my $ithFill = QUOTACELLCOMPLETES($quotaBaseName . $i, 1) / QUOTACELLLIMIT($quotaBaseName . $i, 1);
        if ($ithFill < $thisFill) {
            if ($maxEntriesPerRespondent == 0) {
                return 0;

return 1;
End Unverified

Line 3 must be updated with the name of the select question, as well as line 4 with the base name for this quota question (the name minus the 1 at the end).  Line 5 updated with the number of items in the select question, and line 6 with the maximum number of items a respondent should be able to qualify for.

Next, copy this quota question so you have one quota question for each item from the select question, each on a separate page.  Each one can simply skip to the next question in the questionnaire.  Line 8 of each quota question should be updated to whichever quota question this is.

That should do it.  You can skip respondents based on which cells they were part of with Sawtooth Script like this:

QuotaQ4 = 1
answered Jan 24, 2019 by Zachary Platinum Sawtooth Software, Inc. (205,575 points)