Have an idea?

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

How to Pipe-in Top 5 MaxDiff Attributes?

I have MaxDiff exercises with 20 attributes. After that in one question I want to pipe-in the labels of Top 5 MaxDiff attributes. For that I have created constructed list called MDConList with parent list as MD1List with the below code.

MaxDiffRankAttLabel(MD1, 1)
MaxDiffRankAttLabel(MD1, 2)
MaxDiffRankAttLabel(MD1, 3)
MaxDiffRankAttLabel(MD1, 4)
MaxDiffRankAttLabel(MD1, 5)

Then again I have created another constructed list and within that used the below code.

ADD(MDConList)

However, I am not getting the attributes to the questions and it is skiping to next question.

Am I follwing the help instruction correctly?
asked Feb 14, 2013 by Lawrence Bronze (2,100 points)

1 Answer

+1 vote
If you want to add the ranked items in order then you need to use MaxDiffRankAttValue(MD1, 1) and so on in the constructed list logic.

begin unverified perl
my $listlength = LISTLENGTH('MD1List');
for (my $i = 1; $i <= $listlength; $i++)
{
ADD('MD1List', MAXDIFFRANKATTVALUE('MD1', $i));
}
end unverified


This code will create a constructed list where the order is determined by the maxdiff ranking values.
answered Feb 14, 2013 by Mike Lodder Gold (23,395 points)
If Perl code scares you, you can write it all out with normal list building instructions like this:

ADD(ParentListName,MaxDiffRankAttValue(MD1,1))
ADD(ParentListName,MaxDiffRankAttValue(MD1,2))
ADD(ParentListName,MaxDiffRankAttValue(MD1,3))
ADD(ParentListName,MaxDiffRankAttValue(MD1,4))
ADD(ParentListName,MaxDiffRankAttValue(MD1,5))
...