Have an idea?

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

CBC attribute levels based on predifined list

I am trying to write a perl script in order to display attribute levels based on a predefined list. I want the levels to have a range based on a value on the list. I have tried some things like

[% (List , 1) * 0.5 %]
[% (List , 1) * 0.75 %]
[% (List , 1) * 1.25 %]
[% (List , 1) * 1.5 %]

or
[% (List _1) * 1.5 %]
or
[% (List ==1) * 1.5 %]
or
[% (List (1)) * 1.5 %]

I know that this should be possible somehow. Any help?

Thanks!
asked Jul 29, 2017 by John

1 Answer

0 votes
 
Best answer
If you want the text of a list item, you should use the "ListLabel" function.  Before performing mathematical operations on it, you'll want to call the "StringToNumber" function.  This code will return half of the first value in the list "list1":

[% StringToNumber(ListLabel(list1, 1)) * 0.5 %]
answered Jul 29, 2017 by Zachary Platinum Sawtooth Software, Inc. (81,425 points)
...