Display Random Number

More
3 years 1 month ago #111605 by AudioMan612
AudioMan612 created the topic: Display Random Number
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.

Please Log in to join the conversation.

More
3 years 1 month ago #111612 by holch
holch replied the 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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
The following user(s) said Thank You: AudioMan612

Please Log in to join the conversation.

More
3 years 1 month ago #111614 by AudioMan612
AudioMan612 replied the 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:

Please Log in to join the conversation.

More
3 years 1 month ago #111619 by holch
holch replied the 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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
3 years 1 month ago #111629 by tpartner
tpartner replied the 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.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now