- Posts: 9
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Relevance equation for a question group based on multiple choice
- rhaimila
- Topic Author
- Offline
- New Member
Less
More
4 years 6 months ago #190149
by rhaimila
Relevance equation for a question group based on multiple choice was created by rhaimila
Hi,
I'm trying to hide/show a question group based on a prior multiple choice question. In my ideal scenario, the survey would procede as follows:
1) The participant sees the multiple choice question [Consent1] in question group "Consent". [Consent1] has 3 options, SQ001, SQ002, and SQ003.
2) The participants checks all 3 options of [Consent1] and continues to survey, OR
the participant does not check all 3 options, but only 0, 1 or 2 of the options and is then directed to the end of the survey.
I tried to do this by creating a question group "QGroup2" after "Consent". I would like to hide the question group "QGroup2" for those that checked all options aka gave their consent in [Consent1], and show "QGroup2" to those that did not check all 3 options.
However, I couldn't find instructions on how to form a relevance equation based on a multiple choice question (only a yes/no question). Can anybody help me with this?
Best,
Roosa H
I'm trying to hide/show a question group based on a prior multiple choice question. In my ideal scenario, the survey would procede as follows:
1) The participant sees the multiple choice question [Consent1] in question group "Consent". [Consent1] has 3 options, SQ001, SQ002, and SQ003.
2) The participants checks all 3 options of [Consent1] and continues to survey, OR
the participant does not check all 3 options, but only 0, 1 or 2 of the options and is then directed to the end of the survey.
I tried to do this by creating a question group "QGroup2" after "Consent". I would like to hide the question group "QGroup2" for those that checked all options aka gave their consent in [Consent1], and show "QGroup2" to those that did not check all 3 options.
However, I couldn't find instructions on how to form a relevance equation based on a multiple choice question (only a yes/no question). Can anybody help me with this?
Best,
Roosa H
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11660
- Thank you received: 2742
4 years 6 months ago - 4 years 6 months ago #190154
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 Relevance equation for a question group based on multiple choice
Multiple Choice questions are separated into basically several "Yes/No" questions. Each choice is considered a subquestion.
So to check if your first item has been checked you need to do something like {if(questioncode_subquestioncode=="Y",dosomething, elsedothis)}.
So in your case, to show the group QGroup2 you need to check wether one of the 3 Subquestions is empty, rather than checking if all are "Y".
Something like this relevance equation in QGroup2 should work:
However, this probably will only work if the second question group (QGroup2) is not on the same page as the first group/question, because otherwise the second group would be shown from the beginning and only disappear if someone marks all options.
I just tried this at the LS demo here and it works. The second group shows when at least one of the 3 options from Consent1 has not been marked and thus disappears / doesn't show when all 3 have been marked.
See the attached LSS file (which you should always add for us, when possible, because we do not have to "rebuild" your structure and we can see what you have already tried.
So to check if your first item has been checked you need to do something like {if(questioncode_subquestioncode=="Y",dosomething, elsedothis)}.
So in your case, to show the group QGroup2 you need to check wether one of the 3 Subquestions is empty, rather than checking if all are "Y".
Something like this relevance equation in QGroup2 should work:
Code:
Consent1_SQ001 == "" OR Consent1_SQ002 == "" OR Consent1_SQ003 == ""
However, this probably will only work if the second question group (QGroup2) is not on the same page as the first group/question, because otherwise the second group would be shown from the beginning and only disappear if someone marks all options.
I just tried this at the LS demo here and it works. The second group shows when at least one of the 3 options from Consent1 has not been marked and thus disappears / doesn't show when all 3 have been marked.
See the attached LSS file (which you should always add for us, when possible, because we do not have to "rebuild" your structure and we can see what you have already tried.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Attachments:
Last edit: 4 years 6 months ago by holch.
The following user(s) said Thank You: rhaimila
The topic has been locked.
- rhaimila
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 2
4 years 4 months ago #191645
by rhaimila
Replied by rhaimila on topic Relevance equation for a question group based on multiple choice
Thank you!
This worked.
However: When I designed the questionnaire, I didn't realize that even if the participant sees QGroup2 ("Thank you for your interest") after not giving sufficient consent for the study in Consent1, QGroup2 will automatically have a "Next" button where the participant could still continue to the actual study. So I'll continue by looking for a way the participant would see a page that is not actually a part of the survey (or that will not have a Next button), after not giving sufficient consent in Consent1
Thank you for the great advice, though!
Best,
Roosa H
This worked.
However: When I designed the questionnaire, I didn't realize that even if the participant sees QGroup2 ("Thank you for your interest") after not giving sufficient consent for the study in Consent1, QGroup2 will automatically have a "Next" button where the participant could still continue to the actual study. So I'll continue by looking for a way the participant would see a page that is not actually a part of the survey (or that will not have a Next button), after not giving sufficient consent in Consent1
Thank you for the great advice, though!
Best,
Roosa H
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
4 years 4 months ago - 4 years 4 months ago #191680
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Relevance equation for a question group based on multiple choice
What do want to happen if a respondent does not give consent?
IMO he is screened out. So you have to create a quota with limit 0.
Or you show the page and hide all following questions by relevance.
Meaning they are only displayed if all three options of "Consent" are checked.
A bit shorter:
Joffm
IMO he is screened out. So you have to create a quota with limit 0.
Or you show the page and hide all following questions by relevance.
Meaning they are only displayed if all three options of "Consent" are checked.
Code:
Consent1_SQ001 == "Y" AND Consent1_SQ002 == "Y" AND Consent1_SQ003 == "Y"
Code:
count(that.Consent1) == 3
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 years 4 months ago by Joffm.
The topic has been locked.
- rhaimila
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 2
4 years 4 months ago #191697
by rhaimila
Replied by rhaimila on topic Relevance equation for a question group based on multiple choice
Hi Joffm,
Thank you for the advice! I actually tried creating a quota with limit 0. However, it seems that quotas work by counting if a respondent selects an option - in my case, I would need a quota for not selecting an option (any of the options in Consent1). Therefore, I figured that to use quotas I would need to change this array question with three options into 3 separate questions with two options (yes and no). I'm a bit hesitant to make these changes - it would make the first page longer and require changes to consent part (the study's gone through ethical evaluation).
So I tried moving QGroup2 to the end of the survey, and the "Next" button is now a "Submit" button. I found instructions for hiding the button ( www.limesurvey.org/forum/can-i-do-this-w...t-only-on-some-pages ). Now I'm wondering: since I have a LimeSurvey Pro account do I still have to change the source code myself to hide the Submit button (I'm a total beginner), or should ask LimeSurvey GmbH by email if they can somehow help. Or is there maybe some other way?
So just as a recap, what I would like to happen is:
A) The participant checks all 3 options of Consent1 -> continues with survey, or
The participant leaves one or more options of Consent1 empty -> sees QGroup2 ("Thank you for your interest ..." without any Next/Submit button)
Thank you for the advice! I actually tried creating a quota with limit 0. However, it seems that quotas work by counting if a respondent selects an option - in my case, I would need a quota for not selecting an option (any of the options in Consent1). Therefore, I figured that to use quotas I would need to change this array question with three options into 3 separate questions with two options (yes and no). I'm a bit hesitant to make these changes - it would make the first page longer and require changes to consent part (the study's gone through ethical evaluation).
So I tried moving QGroup2 to the end of the survey, and the "Next" button is now a "Submit" button. I found instructions for hiding the button ( www.limesurvey.org/forum/can-i-do-this-w...t-only-on-some-pages ). Now I'm wondering: since I have a LimeSurvey Pro account do I still have to change the source code myself to hide the Submit button (I'm a total beginner), or should ask LimeSurvey GmbH by email if they can somehow help. Or is there maybe some other way?
So just as a recap, what I would like to happen is:
A) The participant checks all 3 options of Consent1 -> continues with survey, or
The participant leaves one or more options of Consent1 empty -> sees QGroup2 ("Thank you for your interest ..." without any Next/Submit button)
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
4 years 4 months ago #191702
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 equation for a question group based on multiple choice
As Joffm suggests, use group relevance to hide all groups if the respondent does not check Consent1. They will then be sent directly to the end message which could be tailored via Expression Manager.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- rhaimila
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 2
4 years 4 months ago #191705
by rhaimila
Replied by rhaimila on topic Relevance equation for a question group based on multiple choice
Hi Tony,
I tried that but then the participant is directed to the end message that is intended for those who gave their consent ("Thank you for your answers and taking part in the study"), instead of a message that is intended for those that did not give their consent to everything necessary ("Thank you for you interest but we need consent for X and Y", or QGroup2).
Or is it possible to have two different end messages, depending on answers to Consent1?
Thank you for your help,
Roosa
I tried that but then the participant is directed to the end message that is intended for those who gave their consent ("Thank you for your answers and taking part in the study"), instead of a message that is intended for those that did not give their consent to everything necessary ("Thank you for you interest but we need consent for X and Y", or QGroup2).
Or is it possible to have two different end messages, depending on answers to Consent1?
Thank you for your help,
Roosa
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
4 years 4 months ago #191709
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 equation for a question group based on multiple choice
I already said "the end message which could be tailored via Expression Manager.".
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- rhaimila
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 2
4 years 4 months ago #191710
by rhaimila
Replied by rhaimila on topic Relevance equation for a question group based on multiple choice
I know, I was just reading the Expression Manager instructions and couldn't find instructions for this. So I did some googling and found this:
www.limesurvey.org/forum/can-i-do-this-w...fferent-end-messages
(In the answer tailoring end messages was "too complex for Expression Manager alone. You will need to use Expression Manager to pipe in the answers and then use JavaScript to display the appropriate message." But then again, in the question the scenario was more complex than mine)
(In the answer tailoring end messages was "too complex for Expression Manager alone. You will need to use Expression Manager to pipe in the answers and then use JavaScript to display the appropriate message." But then again, in the question the scenario was more complex than mine)
The topic has been locked.
- rhaimila
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 2
4 years 4 months ago #191713
by rhaimila
Replied by rhaimila on topic Relevance equation for a question group based on multiple choice
I now resolved this with tailoring in the end message (by imitating one other earlier response that I found), so all is good!
Thanks,
Roosa
Thanks,
Roosa
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- Ade001
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
3 years 11 months ago #198434
by Ade001
Replied by Ade001 on topic Relevance equation for a question group based on multiple choice
Hey Rhaimila,
would you be kind to share the solution you found? I have having the same issue as yours with content form.
Thanks,
Ade
would you be kind to share the solution you found? I have having the same issue as yours with content form.
Thanks,
Ade
The topic has been locked.
- rhaimila
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 2
3 years 11 months ago #198459
by rhaimila
Replied by rhaimila on topic Relevance equation for a question group based on multiple choice
Hi Ade,
Sure, I used the following as the end message:
{if(Consent1_SQ001 == "" OR Consent1_SQ002 == "" OR Consent1_SQ003 == "", "Message for those who did not check all consent boxes", "Message for those who checked all consent boxes")}
I hid all question groups for those who did not check all the consent boxes by adding the following relevance equation to all question groups:
Consent1_SQ001 == "Y" AND Consent1_SQ002 == "Y" AND Consent1_SQ003 == "Y"
So participants who didn't give full consent were directed straight to the end message. Hope this helps!
Sure, I used the following as the end message:
{if(Consent1_SQ001 == "" OR Consent1_SQ002 == "" OR Consent1_SQ003 == "", "Message for those who did not check all consent boxes", "Message for those who checked all consent boxes")}
I hid all question groups for those who did not check all the consent boxes by adding the following relevance equation to all question groups:
Consent1_SQ001 == "Y" AND Consent1_SQ002 == "Y" AND Consent1_SQ003 == "Y"
So participants who didn't give full consent were directed straight to the end message. Hope this helps!
The following user(s) said Thank You: Ade001
The topic has been locked.