Have an idea?

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

Least Fill List

I need to show two open end questions that say "What is your first association when you hear the name [INSERT BRAND]?"  I have a list of six total brand names to choose from, but I need to choose two of them using least fill so that all brands are shown evenly across respondents and then show the two selected brands in random order.  How would I go about doing this?

I'm using SSI-Web 8.4.8.  Thanks!
asked Sep 23, 2019 by Quentin (470 points)

1 Answer

+1 vote
 
Best answer
Let's start by adding two quota questions to your survey, split by a page break.  Each one's "do not qualify skip" can be set to whatever other question in your survey.  In both quota questions, we're going to add six quota cells.  Give them all a cell limit of 99999 or so.

In the first quota question, set the qualification logic to this:

Begin Unverified Perl
# Parameters
my $firstQuotaQ = 'QuotaQ1';
my $secondQuotaQ = 'QuotaQ2';
my $thisCell = 1;

# Run
my @bestCells = ();
my $bestScore = 9999999;
for (my $i = $thisCell; $i <= 6; $i++) {
    my $ithScore = QUOTACELLCOMPLETES($firstQuotaQ, $i) + QUOTACELLCOMPLETES($secondQuotaQ, $i);
    if ($ithScore < $bestScore) {
        @bestCells = ($i);
        $bestScore = $ithScore;
    }
    elsif ($ithScore == $bestScore) {
        push(@bestCells, $i);
    }
}

return $bestCells[rand(@bestCells)] == $thisCell;
End Unverified


Lines 3 and 4 should be updated with the names of the first and second quota questions, respectively.  Line 5 should be updated with which quota cell the code is being placed into: 1 in the first quota cell, 2 in the second, etc.

In the second quota question, set the qualification logic to this:

Begin Unverified Perl
# Parameters
my $firstQuotaQ = 'QuotaQ1';
my $secondQuotaQ = 'QuotaQ2';
my $thisCell = 1;

# Run
my $firstQuotaQValue = GETVALUE($firstQuotaQ);
my @bestCells = ();
my $bestScore = 9999999;
for (my $i = $thisCell; $i <= 6; $i++) {
    if ($i == $firstQuotaQValue) {
        next;
    }
    my $ithScore = QUOTACELLCOMPLETES($firstQuotaQ, $i) + QUOTACELLCOMPLETES($secondQuotaQ, $i);
    if ($ithScore < $bestScore) {
        @bestCells = ($i);
        $bestScore = $ithScore;
    }
    elsif ($ithScore == $bestScore) {
        push(@bestCells, $i);
    }
}

return $bestCells[rand(@bestCells)] == $thisCell;
End Unverified


Update lines 3 through 5 like we did before.

The values recorded for these two quota questions should be the two items that have been "least fill" selected for the current respondent.  You can use the values directly with Sawtooth Script, or integrate them into a constructed list, or anything else.
answered Sep 25, 2019 by Zachary Platinum Sawtooth Software, Inc. (171,950 points)
selected Sep 25, 2019 by Quentin
Thank you Zachary, you saved me from a big headache.  This was exactly what I needed.
...