Home > Uncategorized > How to randomize answers in a given order

How to randomize answers in a given order

Overview

 

This how to will introduce you to a method of creating different answer randomization according to a given order and script.

Saying for example you have a question with answers 1,2,3,4,5.

For Males it should be asked in the answer order of 2,1,3,5,4 and for females in the order of 5,4,3,1,2.
This will allow you to set these different orders in a few simple steps.

 

Step 1: Hidden Single-Choice question for Order logic

 

Step 2: Set the order logic.

 

Step 3: Use the randomization.

 

 

Step 1: Hidden Single-Choice question for Order logic

 

First, you should create a hidden single-choice question somewhere in the beginning of your survey, representing the relevant orders as answers, for example:
Answer 1: 1,2,3,4,5
Answer 2: 5,1,2,3,4
Answer 3: 4,5,1,2,3
Answer 4: 3,4,5,1,2
Answer 5: 2,3,4,5,1


* For this example this questions index will be 1.

 

Step 2: Set the order logic.

 

Now, you should use SetAnswer() in your desired script, according to your personal survey logic, in order to set the answer of our hidden single-choice question, for example:
SetAnswer(1,3);

 

I have chosen answer 3, therefore, the given order will be:

4,5,1,2,3

 

Step 3: Use the randomization.

 

Now, in the question where I want to change the order of it’s answers, I would place the following code in it’s start script:

RandomizeAnswers(CurrQues, StringToIntArray(SelectedAnswerText(1)));

*RandomizeAnswers(); get’s two parameters.
1st parameter is the question index, 2nd parameter is an array of integers with the given answer indexes.

 

So it would get the selected rotation as a string, for example: “4,5,1,2,3”
turn it into an integer array: {4,5,1,2,3}
And then, randomize this questions answers according to this array.

 

That’s it!

Visit us at: http://www.dooblo.net

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: