Have an idea?

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

Shortened Constructed List

Hi Guys,

I have a long list of items (61), that I am going to restrict based on product ownership (TV,BB,MOB), + a set of items which will be seen by everyone.

I want to construct the relevant list and set the maximum items to 41 (the minimum items possibly shown).  But I cant get the code to work - can you check the below please;

Begin Unverified Perl
 if (GETVALUE("BB")==1)
 if (GETVALUE("TV")==1)
  if (GETVALUE("MOB")==1)

End Unverified

asked Jul 3, 2020 by djtindall Bronze (600 points)

2 Answers

0 votes
Your final ADD statement doesn't have any parameters.  You need a condition and then brackets around the instruction.
answered Jul 3, 2020 by Jay Rutherford Platinum (52,045 points)
I believe the last ADD statement is meant to be without conditions Jay?
I see that now, thanks Paul.  Typically anything with no conditions I put outside of my Perl logic so I didn't even think about that.  I focused on that and missed the double )).  Good one.
0 votes
This line: ADD("ParentList",38,50));             

Should be: ADD("ParentList",38,50);

Remove the last ")".

Providing your Randomize() is outside the "End Unverified", that should be fine. Inside it, you would require to make it upper case.

I also use ListMax(41) as an option which does the job of setting a maximum limit on the constructed list.
answered Jul 3, 2020 by Paul Moon Platinum (100,795 points)
edited Jul 3, 2020 by Paul Moon
excellent - thank you very much!