- Posts: 10
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Relevance with nested conditions
- nfuria
- Topic Author
- Offline
- New Member
Less
More
10 years 6 months ago - 10 years 6 months ago #99865
by nfuria
Relevance with nested conditions was created by nfuria
I have a question that must appears only when some nested conditions are satisfied.
The equation I need is:
(s1.NAOK == "N") or
(s1.NAOK == "Y" and (
( s2>1 && sum(that.s72) == s2) or
( s2>0 && count(s71) > 0)
)
)
But this doesn't works.
Even a simplified version fails but runs in a unexpected way:
(s1.NAOK == "N") or (s1.NAOK == "Y") :: runs ok
(s1.NAOK == "N") or (s1.NAOK == "Y" && s2>0) :: only 2nd condition works
Are there some problem with the use of "and" or "or"?
These conditions are already used in some more validations without problems.
The equation I need is:
(s1.NAOK == "N") or
(s1.NAOK == "Y" and (
( s2>1 && sum(that.s72) == s2) or
( s2>0 && count(s71) > 0)
)
)
But this doesn't works.
Even a simplified version fails but runs in a unexpected way:
(s1.NAOK == "N") or (s1.NAOK == "Y") :: runs ok
(s1.NAOK == "N") or (s1.NAOK == "Y" && s2>0) :: only 2nd condition works
Are there some problem with the use of "and" or "or"?
These conditions are already used in some more validations without problems.
Last edit: 10 years 6 months ago by nfuria. Reason: complement
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
10 years 6 months ago #99876
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 Relevance with nested conditions
Try replacing "&&" with"AND". I have encountered intermittent problems when using ampersands.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- nfuria
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
10 years 6 months ago #99884
by nfuria
Replied by nfuria on topic Relevance with nested conditions
I tried all the combinations possible, using &&, AND, ||, OR.
None works.
I think I can use javascript but I don't know how to verify the answer of a previous question.
None works.
I think I can use javascript but I don't know how to verify the answer of a previous question.
The topic has been locked.
- nfuria
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
10 years 5 months ago #100374
by nfuria
Replied by nfuria on topic Relevance with nested conditions
Solved. As some questions could be hidden, it's necessary to use the "NAOK" suffix.
The correct equation becomes:
(s1 == "N") or
(s1 == "Y" and (
( s2.NAOK>1 && sum(that.s72.NAOK) == s2.NAOK) or
( s2.NAOK>0 && count(s71.NAOK) > 0)
)
)
The correct equation becomes:
(s1 == "N") or
(s1 == "Y" and (
( s2.NAOK>1 && sum(that.s72.NAOK) == s2.NAOK) or
( s2.NAOK>0 && count(s71.NAOK) > 0)
)
)
The topic has been locked.