Have an idea?

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

Pipe in Top 3 Maxdiff attributes Names with (Brand Name)

Hi,

I need to pipe in top 3 Maxdiff attributes Names with brand. I know how to pipe in top 3 attributes from all the attributes but here client wants to select top 3 only from the attributes which are start with client brand name. Could you please let me know how to get this?
asked Mar 29, 2016 by Abdul Bronze (2,630 points)

2 Answers

+1 vote
Hey Abdul,

Sorry for the delay in getting back to you.  Here's the constructed list I used:

Begin Unverified Perl
my $i = 1;
for ($i = 1; $i <= 20; $i++)
{
    my $pos = MAXDIFFRANKATTVALUE("md", $i);
    if ($pos <= 10)
    {
        ADD("attributes", $pos);
    }
}
End Unverified
ListMax(3)
Randomize()


You'll want to replace the "20" in line 3 with the number of MaxDiff items, replace the "md" in line 5 with the name of the MaxDiff exercise, replace the "10" in line 6 with the number of list items in the MaxDiff that are part of the relevant brand (I believe you have 14 such items), and replace "attributes" in line 8 with the name of your list of attributes.
answered Apr 1, 2016 by Zachary Platinum Sawtooth Software, Inc. (147,925 points)
Thanks Zachary. Unfortunately I couldn't use your code as I already got the answer in between these days. Anyway, thanks again for taking time to write to me. Here is my logic, just saved all ranking attributes using
MaxDiffRankAttValue() in hidden variable.
<input name="resultsff_otf1" id="resultsff_otf1" type="hidden" value="[%(MaxDiffRankAttValue(MDMAIN,1)) %]">
<input name="resultsff_otf2" id="resultsff_otf2" type="hidden" value="[%(MaxDiffRankAttValue(MDMAIN,2)) %]">
<input name="resultsff_otf3" id="resultsff_otf3" type="hidden" value="[%(MaxDiffRankAttValue(MDMAIN,3)) %]">
<input name="resultsff_otf4" id="resultsff_otf4" type="hidden" value="[%(MaxDiffRankAttValue(MDMAIN,4)) %]">
......
......


Finally a constructed list to compare the attributes and pipe-in

Begin Unverified Perl
my $j=0;

for(my $i=1;$i<=28;$i++)
{

if (VALUE("resultsff_otf" .$i)==1)
{ 
    ADD('OTTList',1);
    $j=$j+1;
}
if ($j==4)
{last;}
if (VALUE("resultsff_otf" .$i)==2)
{ 
    ADD('OTTList',2);
    $j=$j+1;
}
if ($j==4)
{last;}
....
....
End Unverified
0 votes
Hi Abdul,

I'd do this by adding all the items in order from best to worst. Then remove any items that don't start with the client brand name, and use the ListMax(3) command to trim the list to the top three items.

Hope this helps.

Aaron
answered Mar 29, 2016 by Aaron Hill Gold Sawtooth Software, Inc. (10,995 points)
Thanks Aaron for your response. However I don't think it will help. We should not use ListMax function and should select top 3 from values calculated from Maxdiff. I have added all the items using constructed list (Name: Q2ConList)
ADD(MDList,MaxDiffRankAttValue(MDMain,1))
ADD(MDList,MaxDiffRankAttValue(MDMain,2))
...
...
ADD(MDList,MaxDiffRankAttValue(MDMain,29))


Created constructed list which to add only client brands (name: BrandList)
ADD(MDList,20,25)


And finally created a constructed list to pipe-in top 3 client brands. But I get all client brands instead of top 3. Could you please help me to get top 3 from calculated maxdiff values?

 Begin Unverified Perl
for (my $i=1;$i<=6;$i++)
{

if (LISTHASPARENTMEMBER('Q2ConList',20) and LISTVALUE('BrandList',$i)==20)
{

ADD('MDList',20);
    
}
if (LISTHASPARENTMEMBER('Q2ConList',21) and LISTVALUE('BrandList',$i)==21)
{

ADD('MDList',21);
    
}
if (LISTHASPARENTMEMBER('Q2ConList',22) and LISTVALUE('BrandList',$i)==22)
{

ADD('MDList',22);
    
}
if (LISTHASPARENTMEMBER('Q2ConList',23) and LISTVALUE('BrandList',$i)==23)
{

ADD('MDList',23);
    
}
if (LISTHASPARENTMEMBER('Q2ConList',24) and LISTVALUE('BrandList',$i)==24)
{

ADD('MDList',24);
    
}
if (LISTHASPARENTMEMBER('Q2ConList',25) and LISTVALUE('BrandList',$i)==25)
{

ADD('MDList',25);
    
}
    
}
End Unverified
...