Have an idea?

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

New Drag&Drop Ranking question type - How to adjust number of items to rank?

New Drag&Drop Ranking question - How to adjust number of items to rank?

Dear Sawtooth-Community, I was desperately waiting for the new drag&drop ranking question feature and now I hope you could help me with the following problems:

1) I have five items to choose and rank, however I do not want my respondents to have to rank all of them, but a range from 0 to 5 items. I found the field "Numbers of items to Rank - Partial" in the Settings menu, but what do I type in the box?

2) The 5th item is an "Other" item, i.e. I would like my participants to be able to specify it themselves. Is that possible and how?

Thank you and best regards,
Michael
asked Feb 11, 2016 by summand (385 points)
retagged Feb 11, 2016 by Walter Williams
Any chance something has changed since this question was asked? I too am looking for a solution for item one. I have a list of things to rank, but want to allow for none or all to be ranked.
I've created some code that should be able to achieve the first item.  Please see the edit in my answer below.
This worked really well for me - thank you for providing the code!
Great!  I believe I'll be able to achieve the second request as well in the near future with the release of 9.3.0.

1 Answer

0 votes
Hi Michael,

Unfortunately, there's not an easy way to do either of your requests currently.  I have created two workarounds that may suit your needs.

For your first item, you would need to create a numeric question on a page before the drag-and-drop question and ask the respondent how many items they want to rank.  Then in your drag-and-drop, you would set the partial field to [% NumericQuestion %].

The workaround for the second item uses constructed lists:
1. Create a new predefined list with one of the items set to "Other Specify."
2. Create a checkbox-type select question that uses this list.
3. Create a new constructed list.  Use the predefined list as the constructed list's parent, and give the constructed list this code: AIC(SelectQuestion).
4. On a new page, create a drag-and-drop ranking question that uses the constructed list.

For both workarounds, you would need to be mindful of any skips involved in your study to ensure that respondents don't skip to the ranking question before answering the "helper" questions.

I hope these can serve your needs.  I've brought up your ideas to other members of the team, so they will hopefully be considered for future versions of Lighthouse.

2016/10/17 EDIT:

I have created some code that can allow for a minimum and maximum number of items to rank in drag-to-container ranking questions!

Start by setting the ranking question to require the maximum number of items you want to allow a respondent to submit.  Now put this code in your ranking question's footer:

<script>
$(document).ready(function(){
    var maxRanked = 4;
    var totalItems = 8;
    
    var loadInterval = setInterval(function() {
        if ($('.draggable_button').length == totalItems) {
            // Move items to unranked
            var ranked = Number($('#FreeFormatQ_Var').val());
            for (var i = ranked + 1; i <= maxRanked; i++) {
                $('.unranked_sort_area').append($('.ranked_sort_area > .draggable_button:last-child'));
                $('.unranked_sort_area > .draggable_button:last-child > .rank_display').css('visibility', 'hidden');
                $('.unranked_sort_area > .draggable_button:last-child > input').val('');
            }
            
            // End interval
            clearInterval(loadInterval)
        }
    }, 100);
})
</script>


Lines 3 and 4 need to be updated with the maximum number of items the respondent can rank and the total number of items in the ranking question, respectively.

Next, give the ranking question this custom JavaScript to be called BEFORE system verification:

var minRanked = 2;
var maxRanked = 4;
var ranked = $('.ranked_sort_area > .draggable_button').length;
$('#FreeFormatQ_Var').val(ranked);

if (ranked < minRanked) {
    strErrorMessage = 'Too few items ranked.';
}
else {
    for (var i = ranked + 1; i <= maxRanked; i++) {
        $('.ranked_sort_area').append($('.unranked_sort_area > div:first-child'));
        $('.ranked_sort_area > .draggable_button:last-child').hide();
        $('.ranked_sort_area > .draggable_button:last-child > input').val(i);
    }
}


Lines 1 and 2 should be updated with the minimum and maximum number of items the respondent can rank, respectively.

Now, create a free format question on the same page as the ranking question.  The FF question needs a hidden numerical variable.  The HTML of this question should be this:

<input name="FreeFormatQ_Var" id="FreeFormatQ_Var" type="hidden" value="0">


Finally, put this code anywhere on the page that comes after the ranking question:

[% Begin Unverified Perl
my $maxRanked = 8;
my $ranked = GETVALUE('FreeFormatQ_Var');
for (my $i = 1; $i <= $maxRanked; $i++) {
    if (GETVALUE('RankingQ_' . $i) > $ranked) {
        SETVALUE('RankingQ_' . $i, '');
    }
}
End Unverified %]


Line 2 should be updated with the maximum number of items that can be ranked.

In all of the above codes, "RankingQ" should be replaced with the name of the ranking question and "FreeFormatQ_Var" should be replaced with the name of the free format question and its variable.

2017/02/28 EDIT:

Both of these requests are now possible in 9.3.0!

https://www.sawtoothsoftware.com/support/knowledge-base/sales-questions/253-support/software-downloads/question-library/1751-library-ranged-dnd-ranking

https://www.sawtoothsoftware.com/support/knowledge-base/sales-questions/253-support/software-downloads/question-library/1749-library-other-specify-dnd-ranking
answered Feb 11, 2016 by Zachary Platinum Sawtooth Software, Inc. (79,700 points)
edited Mar 1, 2017 by Zachary
Hi Zach,
Thank you for your quick response. Unfortunately, asking the repsondents beforehand is not an option for my setting... But I would be glad if you keep me posted!
The help page (see excerpt below) makes it sound like it is possible to specify a range of items. Has this been updated recently?

Number of Items to Rank
Indicate whether respondents are required to rank all items, or a range of items (such as ranking only the top three, or ranking from three to five items).  A question is counted toward your license capacity for each response option that is ranked.
 
Note: If you allow respondents to rank a range of items (e.g. from three to five items), the default error text ("Rank Count") for Ranking questions on the Survey Settings | Error Messages tab will not be appropriate.  You may update that error message for the current ranking question using the Advanced button on the edit Ranking Question dialog.  You may use ErrMin() and ErrMax() Sawtooth Script instructions to retrieve the minimum and maximum range values.
Nathan,

Setting a minimum and maximum number of items to rank is possible if the Ranking Format is set to "Input Boxes" or "Combo Boxes."  The italicized note was probably written before we introduced drag and drop, so the writer did not have to specify at the time that the note only applies to non-drag and drop questions.
...