Have an idea?

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

Pass through on-the-fly-ranks

Hi everyone,

I am calculating On-the Fly Scores for my MaxDiff and need to pass rankings out of MaxDiff using hidden variables.
My MaxDiff List contains 31 elements. I need to export a different number than MaxDiffAttValue. For example if element 23 is ranked best, I need to export "42". I tried to use MaxDiffAttLabel to export the internal label ( which I set 42 fpr element 23), but it always exports the "List Member Display text", which seems really weird to me.

In my opinion there are two ways to access this problem:
1. Get the Internal Labels (would be my most preferred way)
2. Do something like if MaxDiffAttValue = 23 then var1 = 42 (which I think must be done in Perl?)

Thanks for your help!
asked Feb 7 by SimonV (140 points)

1 Answer

0 votes
I'm not familiar with any way to read the internal labels from lists during survey runtime, but the second option isn't so bad.  Here's a start at code you can use:

[% Begin Unverified Perl
my %hash = (1 => 11, 2 => 22, 3 => 33, 4 => 44, 5 => 55, 6 => 66, 7 => 77, 8 => 88, 9 => 99, 10 => 1010);
my $mxd = 'MaxDiffExer';
SETVALUE('var1', $hash{MAXDIFFRANKATTVALUE($mxd, 1)});
SETVALUE('var2', $hash{MAXDIFFRANKATTVALUE($mxd, 2)});
End Unverified %]


Line 2 should be updated with how you want to values remapped.  As is, the code turns 1 into 11, 2 into 22, and so forth.

Line 3 should be updated with the name of your MaxDiff exercise.

Finally, you can repeat lines 4 and 5 as necessary to set all your variables to their remapped values.
answered Feb 7 by Zachary Platinum Sawtooth Software, Inc. (95,675 points)
...