Have an idea?

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

randomize a constructed list

I am trying to randomize a constructed list. Below is how I am constructing my list:

The parent list has 15 responses, but my constructed list should only pipe in the predetermined responses based on the selected answers in the previous question.

constructed list:

Begin Unverified Perl
if(VALUE('Q1')>4)
{
ADD('parentlist',1,7);
}
if(VALUE('Q1')<5)
{
ADD('parentlist',8,15);
}
End Unverified

I am then using the constructed list for Q2. Everything works fine, but now I am having trouble randomizing the responses in Q2.

Thanks!

Matt
asked Dec 8, 2016 by mmeads (200 points)

1 Answer

+2 votes
Just add

RANDOMIZE();


before the "End Unverified" and you should be good to go.
answered Dec 8, 2016 by Zachary Platinum Sawtooth Software, Inc. (70,300 points)
Thanks! So that works, but how do I anchor the Other, please specify response to the be the last response on the list?
You just need to add the other specify item after doing the randomization.  Consider this example:

ADD('parent', 1, 3);
RANDOMIZE();
ADD('parent', 4);


This will add all four list items, but only the first three will be randomized.  The fourth item will always appear last.
Thanks! That worked like a charm! I bet  you have already guessed that I am very new to Sawtooth and Perl.
Hey, we all have to start somewhere.  I'm happy to help with your Perl needs as you get going.
...