- Posts: 2
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
8 years 11 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
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.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1128
- Thank you received: 329
8 years 11 months ago #120363
by Ben_V
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)
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
8 years 11 months ago #120364
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
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:
What are you trying to do with that, despite that you are using different " for each of them. And why all those double brackets???
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
8 years 11 months ago #120383
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Can't set random number as condition
Don't bother with the conditions designer. Simply enter one of these in the question relevance field:For the following two questions I tried to set conditions...
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
8 years 11 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?
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.