Have an idea?

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

ACA - Controlling the order of items for 1 attribute in the desirability phase

Does anyone have a work-around that would enable me to control the item order for 1 attribute (so 1 of the items does not appear first) and randomize the order for the other attributes during the desirability phase of an ACA
asked May 3 by HF-RTi (160 points)

1 Answer

0 votes
Please try adding this script to your ACA rating question:

<script>
$(document).ready(function(){
    var numberOfLevels = $('#[% QuestionName() %]_div .inner_table > tbody > tr').length - 1;
    var levels = [];
    for (var i = 2; i <= numberOfLevels; i++) {
        levels.push(i);
    }
    
    var n = levels.length;
    while (n--) {
        var k = Math.floor(n * Math.random());
        var temp = levels[n];
        levels[n] = levels[k];
        levels[k] = temp;
    }
    
    var rand = Math.floor(Math.random() * (numberOfLevels - 1)) + 1;
    levels.splice(rand, 0, 1);
    
    levels.forEach(function(level){
        $('#[% QuestionName() %]_div .inner_table > tbody').append($('#[% QuestionName() %]_' + level + '_row'));
    });
    
    $('#[% QuestionName() %]_div .inner_table > tbody > tr:not(:first-child):even').removeClass('alt_color1').addClass('alt_color2');
    $('#[% QuestionName() %]_div .inner_table > tbody > tr:not(:first-child):odd').removeClass('alt_color2').addClass('alt_color1');
})
</script>
answered May 3 by Zachary Platinum Sawtooth Software, Inc. (124,225 points)
...