Welcome, Guest
Username: Password: Remember me

TOPIC: Prefill a hidden question with a random number

Prefill a hidden question with a random number 2 years 5 months ago #77088

Hi,

Using 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
The administrator has disabled public write access.

Re: Prefill a hidden question with a random number 2 years 5 months ago #77122

  • granen
  • granen's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
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
The administrator has disabled public write access.

Re: Prefill a hidden question with a random number 2 years 5 months ago #77127

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
The administrator has disabled public write access.

Re: Prefill a hidden question with a random number 2 years 5 months ago #77139

  • lfanfoni
  • lfanfoni's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 293
  • Thank you received: 43
  • Karma: 12
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.
The administrator has disabled public write access.

Re: Prefill a hidden question with a random number 2 years 5 months ago #77148

Hi Ifanfoni,
I'm using LimeService, and they're using v1.91, so I can't do that.
The administrator has disabled public write access.

Re: Prefill a hidden question with a random number 2 years 5 months ago #77166

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4130
  • Thank you received: 763
  • Karma: 347
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Prefill a hidden question with a random number 2 years 5 months ago #77208

Thanks tpartner, that worked perfectly!
The administrator has disabled public write access.

Aw: Prefill a hidden question with a random number 2 years 5 months ago #77212

  • Steve
  • Steve's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 494
  • Thank you received: 46
  • Karma: 17
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
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.150 seconds
Donation Image