Welcome to the LimeSurvey Community Forum

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

Relevance conditions not working for group

  • jcpsarsi
  • jcpsarsi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 6 months ago #205424 by jcpsarsi
Dear all,



The attached survey has four groups: 1) job, 2) setting, 3) location, and 4) equation. For the location group, it is supposed to appear if either of the following two conditions is met:

1. Secretary is selected for the job question and "Yes" is selected for the triggered setting group question (set01 == "A2")

2. Either "Coach" or "Teacher" is selected for the job question (regexMatch("/Teacher|Coach/",job01.shown)). In this case, the setting group will be skipped.



As can be seen in the last equation question, with either of the above conditions met, set01=="A2" or regexMatch("/Teacher|Coach/",job01.shown) equals 1. However, the survey only works as intended when the first condition is met, but not the second condition.


Thanks for help!



Bo
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #205425 by Joffm
Replied by Joffm on topic Relevance conditions not working for group
Hi,
because of your filter on "set01" this question is not asked if "Coach" or "Teacher" was selected in "job01".
Therefore the value for "set01" is not defined and the relevance equation will fail.

In these cases you have to use NAOK.

But in my opinion the regex is not necessary.
Just enter
set01.NAOK=="A2" OR job01=="A2" OR job01=="A3"

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: jcpsarsi
The topic has been locked.
  • jcpsarsi
  • jcpsarsi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 6 months ago #205426 by jcpsarsi
Replied by jcpsarsi on topic Relevance conditions not working for group
That is why! I updated the code and it worked beautifully. The reason to use regex is because the full drop down list is much longer and contain multiple teacher (e.g., intervention teacher, resource teacher, classroom teacher, etc.) and coach entries.

Thanks so much!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #205455 by DenisChenu
Replied by DenisChenu on topic Relevance conditions not working for group

jcpsarsi wrote: That is why! I updated the code and it worked beautifully. The reason to use regex is because the full drop down list is much longer and contain multiple teacher (e.g., intervention teacher, resource teacher, classroom teacher, etc.) and coach entries.

Thanks so much!

In this case : i use different string in code,

For exemple here

IT01
IT02
RT01
RT02
CT01


And you can use «substr(job01,0,2) == "IT" or substr(job01,0,2) == "RT"» for example

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • jcpsarsi
  • jcpsarsi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 6 months ago #205479 by jcpsarsi
Replied by jcpsarsi on topic Relevance conditions not working for group
That is a smart strategy. Thanks for sharing!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose