Welcome to the LimeSurvey Community Forum

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

Display Random Number

  • AudioMan612
  • AudioMan612's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 7 months ago #111605 by AudioMan612
Display Random Number was created by AudioMan612
Hi,

Would it be possible to display a random number in a given range? For example, if LimeSurvey is being used out in the field, I would like the ability to have it display a number between 1 and the total number of people in the area (entered by me of course) to select which person to survey.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 7 months ago #111612 by holch
Replied by holch on topic Display Random Number
You can use the expression Manager and the function: rand(1,100) for having a random number between 1 and 100.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: AudioMan612
The topic has been locked.
  • AudioMan612
  • AudioMan612's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 7 months ago #111614 by AudioMan612
Replied by AudioMan612 on topic Display Random Number
Thanks! Now to figure out why it's not working with one of my templates (or can you only do expressions like this with certain types of questions?).


Attachments:
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 7 months ago #111619 by holch
Replied by holch on topic Display Random Number
Did you have a look at the manual how to implement things with Expression Manager? There are some examples of code. I would say, the most obvious thing is that you can't just put the function into the source code like this, because LS doesn't know that it is an equation.

Equations in Expression Manager are usually between { and }.

Have a look at the link about Expression Manager. There are a lot of good examples.

Here is another example: www.limesurvey-consulting.com/how-to-ran...a-limesurvey-survey/

Regarding the problem with span, I guess you should have no space between "<" and "span".

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 7 months ago #111629 by tpartner
Replied by tpartner on topic Display Random Number
The <span> element is inserted when there is an error in Expression Manager.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose