Welcome to the LimeSurvey Community Forum

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

Conditionally displaying groups

  • IlanaWilken
  • IlanaWilken's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago #160276 by IlanaWilken
Conditionally displaying groups was created by IlanaWilken
Hi everyone.

I have five groups in my survey. Groups 1 and 2 are always shown. But I would like to show either group 3, group 4 or group 5 based on an answer given in Group 1. Is this at all possible? I tried my hand at this by entering a condition in the "Relevance" field in each group's summary section. Here is what I entered (in bold):

Show Group 3 if "Q2 == A1" or "Q3 == A1"
Show Group 4 if "Q2 == A2"
Show Group 5 if "Q2 == A3" or "Q3 == A2"

At the moment all three groups are displayed, regardless of what the conditions say/don't say.

Is there a way of doing what I'm trying to do? If not, is there an alternative method that could help me achieve what I want? (Side note: there are about 20 questions in each group, so creating conditions for each one individually is going to be a bit tedious..)

Thanks so much!
Ilana
The topic has been locked.
More
6 years 4 months ago #160278 by fvanderstarre
Replied by fvanderstarre on topic Conditionally displaying groups
Hi,

I think you should specify Q1.NAOK == "A1" || Q3.NAOK == "A1" (where .NAOK means "No Answer OK") etc....
(assuming your questions aren't arrays or multiple choice).
The topic has been locked.
  • IlanaWilken
  • IlanaWilken's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago #160279 by IlanaWilken
Replied by IlanaWilken on topic Conditionally displaying groups
Hi

I've also tried that, with no success. My questions are radio lists, so that's probably why this didn't work.

But thank you for your reply. :) I'll try typing it the way you did, maybe that's the key to getting it to work!
The topic has been locked.
More
6 years 4 months ago #160280 by fvanderstarre
Replied by fvanderstarre on topic Conditionally displaying groups
If A1 is the answer code, it should work. If A1 is the answer that's displayed, then you should use: Q1.shown == "A1".
The topic has been locked.
  • IlanaWilken
  • IlanaWilken's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago - 6 years 4 months ago #160281 by IlanaWilken
Replied by IlanaWilken on topic Conditionally displaying groups
I've changed the relevance equations to:

Show Group 3 if Q2 == "A1" || Q3 == "A1"
Show Group 4 if Q2 == "A2"
Show Group 5 if Q2 == "A3" || Q3 == "A2"

The Group 4's display works perfectly now. (THANK YOU! :) ) However, Groups 3 and 5 aren't displayed at all now. At first, I thought it was the ||, so I changed it back to or again, with still no luck. Could it be that there are two equations in one?
Last edit: 6 years 4 months ago by IlanaWilken.
The topic has been locked.
More
6 years 4 months ago - 6 years 4 months ago #160282 by fvanderstarre
Replied by fvanderstarre on topic Conditionally displaying groups
Can you export your survey as an lss file and upload it here, so I can have a look?
Or check your survey's logic file first...
Last edit: 6 years 4 months ago by fvanderstarre. Reason: Additional info
The topic has been locked.
  • IlanaWilken
  • IlanaWilken's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago #160283 by IlanaWilken
Replied by IlanaWilken on topic Conditionally displaying groups
Hi. Here is my lss file. Thank you very much for your help.

To simplify the post's explanation I used Q1, Q2 and Q3, but here are the actual question codes, so that you'll find them in the lss file.

Show Group 3 (Technical Description: Data) if RT2 == "A1" or RT3 == "A1"
Show Group 4 (Technical Description: Models) if RT2 == "A2"
Show Group 5 (Technical Description: Software) if RT2 == "A3" or RT3 == "A2"
The topic has been locked.
More
6 years 4 months ago #160284 by fvanderstarre
Replied by fvanderstarre on topic Conditionally displaying groups
I can reproduce your issue here. Running out of time now, hope to be able to get back to you after the weekend!
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 4 months ago - 6 years 4 months ago #160285 by Joffm
Replied by Joffm on topic Conditionally displaying groups
Hello, Ilana,

as vanderstarre said you have to use "NAOK"
"RT2.NAOK == "A3" or RT3.NAOK == "A2""
That's because RT2 might not be asked because of the answer in RT1.

See attached example.

Best regards
Joffm

File Attachment:

File Name: limesurvey...7262.lss
File Size:20 KB

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 years 4 months ago by Joffm.
The topic has been locked.
More
6 years 4 months ago #160315 by fvanderstarre
Replied by fvanderstarre on topic Conditionally displaying groups
If you don't want to use "RT2.NAOK == 'A3' ", an alternative is "RT2.shown == 'Model' " etc.... (there the .NAOK is implicit). This will also make your survey logic more obvious, but on the other hand, if your answer description changes, you'll have to change the relevance equation as well.
Cheers, Frank
The topic has been locked.
  • IlanaWilken
  • IlanaWilken's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago #160317 by IlanaWilken
Replied by IlanaWilken on topic Conditionally displaying groups
Success! It finally worked. I changed the relevance equations to:

Show Group 3 if: RT2.NAOK == "A1" OR RT3.NAOK == "A1"
Show Group 4 if: RT2.NAOK == "A2"
Show Group 5 if: RT2.NAOK == "A3" OR RT3.NAOK == "A2"

Thank you so much, everyone. I really appreciate your assistance. :)

Have an awesome week!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose