Welcome to the LimeSurvey Community Forum

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

Can't set random number as condition

  • stefaniegries
  • stefaniegries's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 10 months ago #120352 by stefaniegries
Can't set random number as condition was created by stefaniegries
Hello there!

I want to create a survey that shows 1 out of 2 questions, randomly selected. The questions before and after this shall be the same.

I tried to add an equotation question (hidden) to set a random number. Code is randnumber and the textfield says {rand(1,2)}

For the following two questions I tried to set conditions, I chose constant value. It reads:
randnumer: {rand(1,2)} (qid17745) gleich ((randnumber==”1″))

The relevance equotation says ((randnumer.NAOK == "((randnumber==”2″))"))

But when I start my survey, it shows none of the questions, just leaves them out and goes straight to the next question. What can I do now?

Regards
The topic has been locked.
More
8 years 10 months ago #120363 by Ben_V
Replied by Ben_V on topic Can't set random number as condition
You can maybe adapt the way (used for groups) described here

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 10 months ago #120364 by holch
Replied by holch on topic Can't set random number as condition
And you should have a look at your code. What do you want with "gleich". and have a look at this, I think this doesn't really make sense:
Code:
((randnumer.NAOK == "((randnumber==”2″))"))

What are you trying to do with that, despite that you are using different " for each of them. And why all those double brackets???

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
8 years 10 months ago #120383 by tpartner
Replied by tpartner on topic Can't set random number as condition

For the following two questions I tried to set conditions...

Don't bother with the conditions designer. Simply enter one of these in the question relevance field:

Code:
randnumber == '1'
Code:
randnumber == '2'

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • stefaniegries
  • stefaniegries's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 10 months ago #120574 by stefaniegries
Replied by stefaniegries on topic Can't set random number as condition
I see, my bad. Thanks for your help!

I now encountered a new problem... I want to check my data condition wise. Therefore I checked with Excel, randomnumbers are given there. But with a closer look, the randomnumbers given there do not fit the condition the participants seemed to answer at all. I tried it myself and wrote down my condition, and in my Excel sheet there's a completely different number shown... as if it generated a new random number... is there anything I can do now?
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose