Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

How to make a random AB questionnaires?

  • freezhao
  • freezhao's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago #225576 by freezhao
How to make a random AB questionnaires? was created by freezhao
Please help us help you and fill where relevant:
Your LimeSurvey version: [url=https://localhost/limesurvey/index.php/questionAdministration/view?surveyid=1&gid=11&qid=121#modalSystemInformation]Version 5.2.14+220214[/url]
Own server or LimeSurvey hosting: Own server
Survey theme/template: fruity
==================

 I have a questionnaire with A B (2 sets of questions),I hope the participants  who come into the survey page will be assign to A or B set by random. Can limesurvey do that? Is there any tutorials?  Thanks~!!!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #225580 by Joffm
Replied by Joffm on topic How to make a random AB questionnaires?
Hi,
the first advice is:
Read the maual
[url] www.limesurvey.org/manual/LimeSurvey_Manual [/url]

You already answered your question."by random".
In this chapter of the manual
[url] www.limesurvey.org/manual/ExpressionScri...mplemented_functions [/url]
you find the function "rand(x,y)" to generate a random number between x and y.

So you have generate a random number between 1 and 2.
This is done in a question of type "equation" (Here I call it "random")
[url] www.limesurvey.org/manual/Question_type_-_Equation/en [/url]

Here the function is entered surrounded by curly brackets {rand(1,2)}
But wait:
As you might know from EXCEL a random number function changes its value with each click.
To avoid this, we use this
{if(is_empty(random),rand(1,2),random)}
Meaning: If the random number is still empty, use the function to create one, otherwise leave it as it is.

Now you have variable called "random".
And you split your sets by entering either "random==1" or "random==2" into the field "conditions" of "General settings"


Joffm

Coming back to your question for "tutorials".
There are some sample surveys here
[url] www.limesurvey.org/manual/ExpressionScript_sample_surveys/en [/url]
which you can download and import.
And they are also included in the demo installation of LimeSurvey
[url] demo.limesurvey.org/admin [/url]
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • freezhao
  • freezhao's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago #225586 by freezhao
Replied by freezhao on topic How to make a random AB questionnaires?
Thanks so much Joffm!
I am a freshman to LS, I will try it now!
Thanks again!

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose