Welcome to the LimeSurvey Community Forum

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

Conditions on Subquestions

  • rbnbchr
  • rbnbchr's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 4 days ago - 2 months 4 days ago #257034 by rbnbchr
Conditions on Subquestions was created by rbnbchr
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 3.17.1+190408
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hello everyone,
Can I display or not a subquestion because of a certain condition based on another subquestion?

I have two questions (question type: Array): HHDevices and HHDevices2. Both questions have 7 sub-questions (same sub-questions for both questions) with the answer options: yes, no, I don't know.

For Q2, each sub-question should only appear if the same sub-question in Q1 was answered with "yes".

For Q2, I used the following relevance equation in the "Edit subquestions" for each subquestion: {HHDevices_SQ001=="Yes"} for subquestion 1, {HHDevices_SQ002=="Yes"}, and so on. But it doesn't work (somehow all sub-questions in Q2 disappear).

Is it possible that a subquestion only appears if a subquestion of another question has been answered with Yes? And if so, is it also possible that both questions appear on the same page?

Thank you for your help!
Last edit: 2 months 4 days ago by rbnbchr.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 4 days ago #257037 by Joffm
Replied by Joffm on topic Conditions on Subquestions
Hi,
{HHDevices_SQ001=="Yes"}
This is wrong syntax.
1. There are no curly brackets around the condition
2. The condition itself is wrong

Read the manual here
[url] manual.limesurvey.org/ExpressionScript_-...#Access_to_variables [/url]

Now: Either you use the code of the answer option
So you relevance equation should be something like
HHDevices_SQ001==1 (or whatever code you used for the answer option "Yes")
or the text (code is obviously better)
Then you have to use the property ".shown"
HHDevices_SQ001.shown=="Yes"


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • rbnbchr
  • rbnbchr's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 4 days ago #257041 by rbnbchr
Replied by rbnbchr on topic Conditions on Subquestions
Thank you very much. It worked!

May I ask you additionally what I have to enter as a code instead of 1 or "Yes" if the question type is "Short free text" and I only want to display the sub-question if the participant has written something in the text field.

HHDevices_SQ001.shown==?

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 4 days ago #257042 by Joffm
Replied by Joffm on topic Conditions on Subquestions
1. If the question is a "short free text" there's no subquestion

2. In such a question you usually have no defined values to compare with.
If there's something entered, the question is "not empty".

Please, read the manual, import and study the sample surveys available in the manual (sub chapter of "ExpressionScript) and  also in the demo installation of Limesurvey.
It's important that you are familiar with these basics.

Joffm 

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 3 days ago #257086 by holch
Replied by holch on topic Conditions on Subquestions

Version 3.17.1+190408


Your version of LS was released on 08/04/2019, it is basically "pre-pandemic" or in other words "ancient".

You should really consider an update. Your installation has not received any bug fixes, security patches and updates for almost 5 years now. For a software that is accessible from the internet and potentially collects private date from respondents, you should keep this software fairly up to date.

Your branch of LS is also EOL now and not supported anymore.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose