Have an idea?

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

ACBC - Cloning price attribute

Hi Zachary,

I am using your suggestion given in the below link to clone the price attribute


My requirement is to clone the summed price attribute depends on its value and brand attribute. For example

Brand name            Summed price                 Cloning price [Require output]
----------------             -------------------                 ------------------

Verizon                            45                                            85
Verizon                            50                                            95
Verizon                            55                                            105
Sprint                               45                                            115
Sprint                               50                                            125
Sprint                               55                                            135

I could able to clone it based on summed price value but could not add brand name logic in it.

Here is my code, I tried a variable called 'bname' to fetch the name of the brand but it doesn't work. Please help me.

    var params = {
        priceRow: 6,
        label: 'Price for 2 Lines',
        currencySymbol: '$',
        currencySymbolBefore: true

    // Screener / Choice Task
    if ($('.acbc_screener, .acbc_choicetask').length) {
        // Add per-person row
        var priceRow = $('#[% QuestionName() %]_div .inner_table > tbody > tr:nth-child(' + params.priceRow + ')');

        // Per-person label
        var perPersonRow = $('#[% QuestionName() %]_div .inner_table > tbody > tr:nth-child(' + (params.priceRow + 1) + ')');
        $(perPersonRow).find('.label_text_cell .label_text').text(params.label);

        // Per-person values
        $(perPersonRow).find('.level_text_cell .level_text').each(function(){
            var price = $(this).text().replace(params.currencySymbol, '');
            // To fetch brand name
            var bname = $('table tbody tr:nth-child(2)').children('td').eq( $(this).index() ).text();
if (bname=="Verizon" && price==45)
{price = 85;}
else if (bname=="Verizon" && price==50)
{price = 95;}
else if (bname=="Verizon" && price==55)
{price = 105;}
else if (bname=="Sprint" && price==45)
{price = 115;}
else if (bname=="Sprint" && price==50)
{price = 125;}
else if (bname=="Sprint" && price==55)
{price = 135;}
{price = 999;}
            price = Math.round(price);
            if (params.currencySymbolBefore) {
                price = params.currencySymbol + price;
            else {
                price += params.currencySymbol;
asked Oct 18, 2017 by Abdul Bronze (2,630 points)

1 Answer

0 votes
Changing the summed price values with JavaScript is inadvisable.  Respondents seeing a different price than what Lighthouse believes the respondent saw is harmful to utility estimation.

As an alternative, ACBC's have a "Price Adjustments" setting found in the pricing tab that allows you to modify the price of one attribute based on the value of another attribute.  This setting may be helpful in your situation.
answered Oct 18, 2017 by Zachary Platinum Sawtooth Software, Inc. (147,925 points)
Sorry Zachary, I think i have not clearly explained the problem. I am not trying to change the summed price values. I will keep it as it is but want duplicate row of summed price (cloning row) next to summed price row at run time using jquery. The duplicate row value should be based on summed price value and respective brand name. For example, if brand name is 'Verizon' and summed price value is '45' then the run time duplicate row should have the value '85'. I could able to create duplicate row at run time (line no 14 & 15 in my code) and also added summed price logic (line no 23, 24 & 27). I am facing problem in adding brand name logic in the code (line no 26 & 27). Hope it is clear now. Please let me know if it is not still clear.
I consulted with Bryan Orme about your situation and I'm still not certain I can recommend adding the modified price clone attribute, even with the original price attribute still displayed.  A respondent could select a concept based off the modified attribute and the utilities estimation would have no way of knowing.