- Posts: 26
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Help with logical statements
- h1ghland3r
- Topic Author
- Offline
- Junior Member
Less
More
8 years 4 months ago #127930
by h1ghland3r
Help with logical statements was created by h1ghland3r
Hello guys,
First of all, sorry for my English.
I'm making my first survey using LimeSurvey. Right now, I am stuck with logical statements. For better understanding, follow some explanations.
1) I have one multiple choice question with 25 items.
2) Each five of these items have a category. Let's say: Category A (Items 1-5), B (Items 6-10), C (Items 11-15), D (Items 16-20) and E (Items 21-25).
3) Depending on the user's choice, I want the user answers questions related with the category. So, I have questions (array) for A, B, C, D and E.
So, when the user selects only items from A, they will answer the a next question related with A.
But when the user select questions for both category A, B and E. I want the next question shows questions from these three categories.
4) Follows my logic (that I believe it's wrong).
SB = sub-question
Ex: Questions only for category A:
((SB01.NAOK == "Y")) or ((SB02.NAOK == "Y")) or ((SB03.NAOK == "Y")) or ((SB04.NAOK == "Y")) or ((SB05.NAOK == "Y")) and ((( ! SB06.NAOK == "Y")) or (( ! SB07.NAOK == "Y")) or (( ! SB08.NAOK == "Y")) or (( ! SB09.NAOK == "Y")) or (( ! SB10.NAOK == "Y")) and ((( ! SB11.NAOK == "Y")) or (( ! SB12.NAOK == "Y")) or (( ! SB13.NAOK == "Y")) or (( ! SB14.NAOK == "Y")) or (( ! SB15.NAOK == "Y"))) and ((( ! SB16.NAOK == "Y")) or (( ! SB17.NAOK == "Y")) or (( ! SB18.NAOK == "Y")) or (( ! SB19.NAOK == "Y")) or (( ! SB20.NAOK == "Y"))) and ((( ! SB21.NAOK == "Y")) or (( ! SB22.NAOK == "Y")) or (( ! SB23.NAOK == "Y")) or (( ! SB24.NAOK == "Y")) or (( ! SB25.NAOK == "Y")))
Ex: Questions for category A, B and E:
((SB01.NAOK == "Y")) or ((SB02.NAOK == "Y")) or ((SB03.NAOK == "Y")) or ((SB04.NAOK == "Y")) or ((SB05.NAOK == "Y")) and (((SB06.NAOK == "Y")) or ((SB07.NAOK == "Y")) or ((SB08.NAOK == "Y")) or ((SB09.NAOK == "Y")) or ((SB10.NAOK == "Y")) and ((( ! SB11.NAOK == "Y")) or (( ! SB12.NAOK == "Y")) or (( ! SB13.NAOK == "Y")) or (( ! SB14.NAOK == "Y")) or (( ! SB15.NAOK == "Y"))) and ((( ! SB16.NAOK == "Y")) or (( ! SB17.NAOK == "Y")) or (( ! SB18.NAOK == "Y")) or (( ! SB19.NAOK == "Y")) or (( ! SB20.NAOK == "Y"))) and (((SB21.NAOK == "Y")) or ((SB22.NAOK == "Y")) or ((SB23.NAOK == "Y")) or ((SB24.NAOK == "Y")) or ((SB25.NAOK == "Y")))
When I select items for both categories A, B and E. The next group show questions A, for B. Then, repeat questions for A, B and then show questions for E. :blink:
Someone can help me how solve this issue?
Thanks a lot!
:laugh:
First of all, sorry for my English.
I'm making my first survey using LimeSurvey. Right now, I am stuck with logical statements. For better understanding, follow some explanations.
1) I have one multiple choice question with 25 items.
2) Each five of these items have a category. Let's say: Category A (Items 1-5), B (Items 6-10), C (Items 11-15), D (Items 16-20) and E (Items 21-25).
3) Depending on the user's choice, I want the user answers questions related with the category. So, I have questions (array) for A, B, C, D and E.
So, when the user selects only items from A, they will answer the a next question related with A.
But when the user select questions for both category A, B and E. I want the next question shows questions from these three categories.
4) Follows my logic (that I believe it's wrong).
SB = sub-question
Ex: Questions only for category A:
((SB01.NAOK == "Y")) or ((SB02.NAOK == "Y")) or ((SB03.NAOK == "Y")) or ((SB04.NAOK == "Y")) or ((SB05.NAOK == "Y")) and ((( ! SB06.NAOK == "Y")) or (( ! SB07.NAOK == "Y")) or (( ! SB08.NAOK == "Y")) or (( ! SB09.NAOK == "Y")) or (( ! SB10.NAOK == "Y")) and ((( ! SB11.NAOK == "Y")) or (( ! SB12.NAOK == "Y")) or (( ! SB13.NAOK == "Y")) or (( ! SB14.NAOK == "Y")) or (( ! SB15.NAOK == "Y"))) and ((( ! SB16.NAOK == "Y")) or (( ! SB17.NAOK == "Y")) or (( ! SB18.NAOK == "Y")) or (( ! SB19.NAOK == "Y")) or (( ! SB20.NAOK == "Y"))) and ((( ! SB21.NAOK == "Y")) or (( ! SB22.NAOK == "Y")) or (( ! SB23.NAOK == "Y")) or (( ! SB24.NAOK == "Y")) or (( ! SB25.NAOK == "Y")))
Ex: Questions for category A, B and E:
((SB01.NAOK == "Y")) or ((SB02.NAOK == "Y")) or ((SB03.NAOK == "Y")) or ((SB04.NAOK == "Y")) or ((SB05.NAOK == "Y")) and (((SB06.NAOK == "Y")) or ((SB07.NAOK == "Y")) or ((SB08.NAOK == "Y")) or ((SB09.NAOK == "Y")) or ((SB10.NAOK == "Y")) and ((( ! SB11.NAOK == "Y")) or (( ! SB12.NAOK == "Y")) or (( ! SB13.NAOK == "Y")) or (( ! SB14.NAOK == "Y")) or (( ! SB15.NAOK == "Y"))) and ((( ! SB16.NAOK == "Y")) or (( ! SB17.NAOK == "Y")) or (( ! SB18.NAOK == "Y")) or (( ! SB19.NAOK == "Y")) or (( ! SB20.NAOK == "Y"))) and (((SB21.NAOK == "Y")) or ((SB22.NAOK == "Y")) or ((SB23.NAOK == "Y")) or ((SB24.NAOK == "Y")) or ((SB25.NAOK == "Y")))
When I select items for both categories A, B and E. The next group show questions A, for B. Then, repeat questions for A, B and then show questions for E. :blink:
Someone can help me how solve this issue?
Thanks a lot!
:laugh:
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11746
- Thank you received: 2750
8 years 4 months ago #127931
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 Help with logical statements
Not sure why you include the "NOT" part (that you have marked in red.
So, in the relevance equation for the questions from the category A you would put something like this.
I am not quite sure if you need the "((". But something like this statement would show the question only, if one of those subquestions from SB01 to SB05 was marked. One is suficient. But from what I understood, this is actually what you want.
Similar things you do for the other categories.
So, in the relevance equation for the questions from the category A you would put something like this.
Code:
SB01.NAOK == "Y" OR SB02.NAOK == "Y" OR SB03.NAOK == "Y" OR SB04.NAOK == "Y" OR SB05.NAOK == "Y"
I am not quite sure if you need the "((". But something like this statement would show the question only, if one of those subquestions from SB01 to SB05 was marked. One is suficient. But from what I understood, this is actually what you want.
Similar things you do for the other categories.
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.
- h1ghland3r
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 26
- Thank you received: 1
8 years 4 months ago #127933
by h1ghland3r
I will try without the parenthesis.
About the ! (not), the reason is because I am trying to avoid the repeated questions.
Replied by h1ghland3r on topic Help with logical statements
holch wrote: Not sure why you include the "NOT" part (that you have marked in red.
So, in the relevance equation for the questions from the category A you would put something like this.Code:SB01.NAOK == "Y" OR SB02.NAOK == "Y" OR SB03.NAOK == "Y" OR SB04.NAOK == "Y" OR SB05.NAOK == "Y"
I am not quite sure if you need the "((". But something like this statement would show the question only, if one of those subquestions from SB01 to SB05 was marked. One is suficient. But from what I understood, this is actually what you want.
Similar things you do for the other categories.
I will try without the parenthesis.
About the ! (not), the reason is because I am trying to avoid the repeated questions.
The topic has been locked.
- h1ghland3r
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 26
- Thank you received: 1
8 years 4 months ago - 8 years 4 months ago #127936
by h1ghland3r
Replied by h1ghland3r on topic Help with logical statements
Got it ! Finally.
The answer was easier than I thought. I only need of 5 questions, each one matching the criteria of a category.
The !(not) is not necessary as you pointed @holch. I kept the parenthesis anyway, I think is better to organize.
The answer was easier than I thought. I only need of 5 questions, each one matching the criteria of a category.
The !(not) is not necessary as you pointed @holch. I kept the parenthesis anyway, I think is better to organize.
Last edit: 8 years 4 months ago by h1ghland3r. Reason: mistyping
The topic has been locked.