Have an idea?

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

Skip to random page

We would like to randomly forward / skip respondents in a survey to 1 of 3 possible subsequent pages with different content (from introduction text to either text 1, text 2 or text 3). In order to know which respondent was assigned to which random page, an invisible variable should be created holding this information.

I hope someone can help out.

Thank you very much!
asked Jun 11 by Andrew Bronze (1,255 points)

1 Answer

+1 vote
You can randomly generate a number from 1-3, save it, and use it in skip logic to control which questions to display.

In this example below, a variable called "PageSelect" will store a random number between 1-3. Define "PageSelect" as a pass-in field and set it as a whole number. In skip logic, use PageSelect=1 or PageSelect=2 or PageSelect=3. Insert this script in to an appropriate question (one that is not skipped and appears before the questions text1, text2, text3 you referred to).
[%SetValue(PageSelect,SysRand(1,3))%]

You should find a reasonable equal distribution of PageSelect using this method, but if you want it to be more precise, you can use a least fill quota approach. In this situation, you create a quota question with 3 cells. Select the least fill option. Now use this quota question in your skip logic.
answered Jun 11 by Paul Moon Platinum (91,280 points)
edited Jun 11 by Paul Moon
Andrew, Paul has provided great options!  It looks like you plan to have an IntroText question so you should be able to drop that setvalue script there.  You could use the post skip logic to go to the right text question as Paul indicated, but a reminder that you will need to have an 'always skip' postskip on each of those text questions to go to the next question of the survey.  I've found it would take less skip logic to just add a preskip to each of those text questions.  So for the first text question, add a preskip of PageSelect<>1 skipto next question and then do the same for the other 2.
Paul and Jay,

thank you very much!

I am currently trying Paul's suggestion. Unfortunately I can't get it to work. I put the code
[%SetValue(PageSelect,SysRand(1,3))%]

in the footer of the introduction (just a text question directed to all participants). In the Skip logic I added 3 skips: Post-Skip, PageSelect = 1, Skip To text1; Post-Skip, PageSelect = 2, Skip To text2 same for text3 . But I always end up on the random page text1. Something I'm doing wrong.
Andrew, did you define "PageSelect" as a pass-in field and set it as a whole number?

Ensure the question you place this script in to is before any of the questions text1, text2, text3.

Your first test is to see "PageSelect" capture a 1-2-3. Once that is done, we can move on to testing the skips.
Did you set up the pass-in variable of PageSelect as Paul mentioned?  Also, don't forget that on each of those text questions you will need a post skip set to always skip to your next question in the survey (so you don't just go to the next text question).
Paul and Jay,

yes, I guess I was a little hasty. Now it works perfectly. This just made my day.

Thank you very much again!
Team work gents! Team work!

Well done Andrew.

Appreciate your timely comments too Jay as always.
...