Welcome to the LimeSurvey Community Forum

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

problems randomising survey using rand().

More
5 years 10 months ago #179378 by FeCanever
Replied by FeCanever on topic problems randomising survey using rand().
Hi, Tony,

first of all thanks for the quick answer. In my survey there will be 8 conditions, but I forgot to say that for now I was testing with 2. Sorry about that.

So you're saying it is possible to add the assigned info (random == 1, random == 2, and so on) to the relevance field for group instead of doing that for each question inside the group.

I just did what you said for the 2 groups I'm testing with and no question groups are displayed when I preview the survey.

What do you think I'm doing wrong?
The topic has been locked.
More
5 years 10 months ago #179380 by FeCanever
Replied by FeCanever on topic problems randomising survey using rand().
Hi again,

I tried ((random == "1")) instead of ((random == 1)) and now it works!

Thanks a lot!
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
5 years 10 months ago #179383 by DenisChenu
Replied by DenisChenu on topic problems randomising survey using rand().

FeCanever wrote: Hi again,

I tried ((random == "1")) instead of ((random == 1)) and now it works!

Thanks a lot!

It's an issue , because it work like you say in 2.6lts and 2.73.

I think you must report it.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #179404 by tpartner
Replied by tpartner on topic problems randomising survey using rand().
Yes, the result of rand() should be recognized as a number.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
5 years 10 months ago #179407 by DenisChenu
Replied by DenisChenu on topic problems randomising survey using rand().
In fact : not exactly :).

Because you can force it as number :).

BUT Something.NAOK == 1 must work if Something.NAOK === "1" and Something.NAOK === 1


See this old discussion here : bugs.limesurvey.org/view.php?id=8324 (at this time : i think we must compare it as string if === "1")
And old issue here : bugs.limesurvey.org/view.php?id=7805

And new issue here : bugs.limesurvey.org/view.php?id=14337

There are a major issue in Expression for all numeric value in 3.X

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago - 5 years 10 months ago #179412 by tpartner
Replied by tpartner on topic problems randomising survey using rand().
Yes exactly!

"rand — Generate a random integer" - php.net/manual/en/function.rand.php

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 10 months ago by tpartner.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
5 years 10 months ago #179415 by DenisChenu
Replied by DenisChenu on topic problems randomising survey using rand().
yes, but i think it must not depend on the way it was saved too :)

@FeCanever : can you test with www.limesurvey.org/manual/Question_type_...y_.28numbers_only.29 to ON ?

And can you report the issue with a simple survey (2 group only)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
5 years 10 months ago #179449 by FeCanever
Replied by FeCanever on topic problems randomising survey using rand().
Hi,
I tested with manual.limesurvey.org/Question_type_-_Eq...y_.28numbers_only.29 to ON and it now works if I use ((random == 1)) and ((random == 2)), without the quotes. Awsome!

Sorry about my silly question, but what do you mean when you ask If I can report it? Do you mean here to you guys and to support?
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
5 years 10 months ago #179455 by DenisChenu
Replied by DenisChenu on topic problems randomising survey using rand().
Support forum : the place to ask free help by LimeSurvey user.
Bug report : www.limesurvey.org/community/bug-tracker the place to report bug.

It's not because i'm on Forum and on Mantis than you don't have to report issue

A bug not reported on mantis is a bug not fixed

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
5 years 10 months ago #179464 by FeCanever
Replied by FeCanever on topic problems randomising survey using rand().
Ok, great. I'll do that!
The following user(s) said Thank You: DenisChenu
The topic has been locked.
More
5 years 10 months ago - 5 years 10 months ago #179477 by FeCanever
Replied by FeCanever on topic problems randomising survey using rand().
Denis,

When I was getting ready to report the bug in the support forum, I turned off the "numbers_only" option, and somehow it now works even if I let ((random ==1)) without the quotes. Should I go ahead and report it anyway?
Last edit: 5 years 10 months ago by FeCanever.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
5 years 10 months ago #179483 by DenisChenu
Replied by DenisChenu on topic problems randomising survey using rand().
In my opinion : since we have issue (fixed) with previous release, it's a bug in this new release.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose