Have an idea?

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

Rotate a list

Hi. Has anyone thought of a clever way to rotate a list rather than randomize it?

On way might be to first generate a random number (e.g. from 1 to 10 if 10 codes in list) and use this as the starting code, then use unverified perl to add the list members. e.g.

if start code=5 then add codes 6/10 then 1/4
if start code=6 then add codes 7/10 then 1/5... etc

This should work but could get time consuming to set up if there are many long lists. Anyone thought of a nicer way?

asked Jul 9, 2013 by rapizel Bronze (1,420 points)

1 Answer

+2 votes
I think the question becomes why would you want to do that?  There is the randomize option for predefined lists at the question level or you can use the randomize command in a constructed list.  What are you looking to achieve by not using those options?
answered Jul 9, 2013 by Jay Rutherford Gold (31,520 points)
Answer: Because client wants it. I agree, rotating code frames seems unnecessary unless there is an obvious reason to keep codes in the same relative order...  e.g. keep codes for models of a car make together, but rotate the order in which the different makes are show in.
I see this randomise versus rotate issue come up from time to time. With some tricky Perl and SSI Script programming, you can get around this issue but it depends greatly on the length of the list you are rotating, are blocks or sub-groups involved, etc.

Question for the Sawtooth team - is it easy to add in a ROTATE tick box at a question level and also a ROTATE function in SSI Script? I guess you could also throw in ROTATE BLOCKS too?