Prefill a hidden question with a random number

More
5 years 8 months ago #77088 by davidspivak
davidspivak created the topic: Prefill a hidden question with a random number
Hi,

Using LimeSurvey Professional (previously LimeService).
How do I prefill a hidden question with a random number (either 1 or 2)?

I want to use this question for random assignment of participants to groups.
If answer is 1 show participants a specific question, and if answer is 2 show them another question (I know how to do this).

Thanks!
David

Please Log in to join the conversation.

More
5 years 8 months ago #77122 by granen
granen replied the topic: Prefill a hidden question with a random number
Hi,

If it is a closed survey I normally uses attributes to do this. Create random numbers between 1 and 2 in the excel table and import together with email.

//Erik

Please Log in to join the conversation.

More
5 years 8 months ago #77127 by davidspivak
davidspivak replied the topic: Prefill a hidden question with a random number
Hi granen,

Thanks for your reply.

What do you mean by 'closed survey'? using tokens? because if that's the case, I'm not using tokens - anyone can participate in my survey.

Thanks,
David

Please Log in to join the conversation.

More
5 years 8 months ago #77139 by lfanfoni
lfanfoni replied the topic: Prefill a hidden question with a random number
With the new version (1.92), you can use the question type "equation" and define the formula: rand(1,2). You can also hide this question.
The problem is that the random value is calculated at the moment of the page loading, so you have to put the specific question at the next group or page.

Please Log in to join the conversation.

More
5 years 8 months ago #77148 by davidspivak
davidspivak replied the topic: Prefill a hidden question with a random number
Hi Ifanfoni,
I'm using LimeSurvey Professional (previously LimeService), and they're using v1.91, so I can't do that.

Please Log in to join the conversation.

More
5 years 8 months ago #77166 by tpartner
tpartner replied the topic: Prefill a hidden question with a random number

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 8 months ago #77208 by davidspivak
davidspivak replied the topic: Prefill a hidden question with a random number
Thanks tpartner, that worked perfectly!

Please Log in to join the conversation.

More
5 years 8 months ago #77212 by Steve01
Steve01 replied the topic: Aw: Prefill a hidden question with a random number
You're welcome :-)

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.

Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!