- Posts: 22
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
how to auto tick an answer option based on previous question and hide remaining
- BOBYJAMES
- Topic Author
- Offline
- Junior Member
Less
More
4 years 4 months ago - 4 years 4 months ago #191874
by BOBYJAMES
how to auto tick an answer option based on previous question and hide remaining was created by BOBYJAMES
Thanks in advance
hii i want to auto answer a question based on the previous question
q5 , Please can you tell me your age
//here a numeric answer
q6 , actual age group is
1, Less than 20 years
2, 20 – 24 years
3, 25 – 29 years
4, 30 – 35 years
5, 36 – 40 years
6, 40+ years
if we put the answer of q5 is 27 , then auto code the q6 answer as answer option 3 and only show this answer option in display
hii i want to auto answer a question based on the previous question
q5 , Please can you tell me your age
//here a numeric answer
q6 , actual age group is
1, Less than 20 years
2, 20 – 24 years
3, 25 – 29 years
4, 30 – 35 years
5, 36 – 40 years
6, 40+ years
if we put the answer of q5 is 27 , then auto code the q6 answer as answer option 3 and only show this answer option in display
Last edit: 4 years 4 months ago by BOBYJAMES.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
4 years 4 months ago - 4 years 4 months ago #191894
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 how to auto tick an answer option based on previous question and hide remaining
I'm not sure what you mean by "and only show this answer option in display" but you can use the Expression Manager
assignment operator
in an equation question to set the value of a list-radio question based on the value in a numeric question.
Something like this in the equation question (line-breaks inserted for clarity):
Sample survey attached:
Something like this in the equation question (line-breaks inserted for clarity):
Code:
{q6 = if(intval(q5) < 20, '1', if(intval(q5) < 25, '2', if(intval(q5) < 30, '3', if(intval(q5) < 34, '4', if(intval(q5) < 40, '5', '6')))))}
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last edit: 4 years 4 months ago by tpartner.
The topic has been locked.
- BOBYJAMES
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
- Thank you received: 0
4 years 4 months ago #191926
by BOBYJAMES
Replied by BOBYJAMES on topic how to auto tick an answer option based on previous question and hide remaining
Thanks for your reply..
up to this its working... "and only show this answer option in display" is if we select an answer 32... then in the next question only show the 30-35 years .. automatically hide other answer options... what we do for this... ?
up to this its working... "and only show this answer option in display" is if we select an answer 32... then in the next question only show the 30-35 years .. automatically hide other answer options... what we do for this... ?
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12923
- Thank you received: 3977
4 years 4 months ago #191928
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic how to auto tick an answer option based on previous question and hide remaining
Hi,
why do you want to show this question with this - single - answer option?
It is already ticked, the respondent canot change - so why do you want to display this?
Usually we use this scenario to ask the age as open answer, but afterwards calculate the ranges (in the background) to be able to do statistical tests. But this question is hidden.
If you really want to display the age range of the respondent, you should use just a text display.
By the way: If I see something like that (only one single choice answer option displayed) I know there was a mistake in the programming of the questionnaire.
Joffm
why do you want to show this question with this - single - answer option?
It is already ticked, the respondent canot change - so why do you want to display this?
Usually we use this scenario to ask the age as open answer, but afterwards calculate the ranges (in the background) to be able to do statistical tests. But this question is hidden.
If you really want to display the age range of the respondent, you should use just a text display.
By the way: If I see something like that (only one single choice answer option displayed) I know there was a mistake in the programming of the questionnaire.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- BOBYJAMES
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
- Thank you received: 0
4 years 4 months ago #191930
by BOBYJAMES
Replied by BOBYJAMES on topic how to auto tick an answer option based on previous question and hide remaining
Thanks for ur reply..
what you said is i will discuss with client.. and i have one more doubt..
how we can select an answer option based on a previous multiple answer question..
eg.
q15. Which of these has been consumed in your household in the past 3 months ? Read from list - Multiple Answer
1, Biscuits
2, Bread
3, Cake
4, Chocolate / Cheese Wafers or Rolls
5, Instant Noodles
q16. Has your household consumed bread in past 3 months ? Single Answer
1, yes
2, no
we need to auto-select the first answer option of q16 if anyone coded answer 2 in q15... can you please help?
what you said is i will discuss with client.. and i have one more doubt..
how we can select an answer option based on a previous multiple answer question..
eg.
q15. Which of these has been consumed in your household in the past 3 months ? Read from list - Multiple Answer
1, Biscuits
2, Bread
3, Cake
4, Chocolate / Cheese Wafers or Rolls
5, Instant Noodles
q16. Has your household consumed bread in past 3 months ? Single Answer
1, yes
2, no
we need to auto-select the first answer option of q16 if anyone coded answer 2 in q15... can you please help?
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12923
- Thank you received: 3977
4 years 4 months ago - 4 years 4 months ago #191931
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic how to auto tick an answer option based on previous question and hide remaining
Just the same as Tony explained already.
{Q16=if(q15_SQ002=="Y",1,2)}
SQ002: depends on your code of the subquestion.
Joffm
{Q16=if(q15_SQ002=="Y",1,2)}
SQ002: depends on your code of the subquestion.
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.
- BOBYJAMES
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
- Thank you received: 0
4 years 4 months ago #192002
by BOBYJAMES
Replied by BOBYJAMES on topic how to auto tick an answer option based on previous question and hide remaining
many thanks..... its working..
how we set qouta or termination in multiple answer question
eg.
q9 . Which of these restaurants you visited with your family in the past 4 weeks for dining in?
SHOW PHOTOCARD LOGO. MULTIPLE ANSWER
a1, Bakmi GM
a2, Domino’s Pizza
a3, HokBen
a4, KFC
a5, McDonald’s
a6, Papa Ron’s
a7, Pizza Hut Restaurant
a8, Platinum
a9, Solaria
if we select answer option kfc or pizza hut we need to continue, otherwise terminate... but the answer who select kfc & pizza hut and any other option should be continue..
how we do this termination ?
how we set qouta or termination in multiple answer question
eg.
q9 . Which of these restaurants you visited with your family in the past 4 weeks for dining in?
SHOW PHOTOCARD LOGO. MULTIPLE ANSWER
a1, Bakmi GM
a2, Domino’s Pizza
a3, HokBen
a4, KFC
a5, McDonald’s
a6, Papa Ron’s
a7, Pizza Hut Restaurant
a8, Platinum
a9, Solaria
if we select answer option kfc or pizza hut we need to continue, otherwise terminate... but the answer who select kfc & pizza hut and any other option should be continue..
how we do this termination ?
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12923
- Thank you received: 3977
4 years 4 months ago #192017
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic how to auto tick an answer option based on previous question and hide remaining
Create a single punch question (S1) with two answer options
By equation set
{S1=if(q9_a7=="Y" OR q9_a4=="Y",1,2)}
Now you set your quota on S1==2, which is the screenout condition.
Joffm
By equation set
{S1=if(q9_a7=="Y" OR q9_a4=="Y",1,2)}
Now you set your quota on S1==2, which is the screenout condition.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- BOBYJAMES
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
- Thank you received: 0
4 years 4 months ago #192033
by BOBYJAMES
Replied by BOBYJAMES on topic how to auto tick an answer option based on previous question and hide remaining
Thanks for your reply..
its working as you said..
But the respondent no need to see the newly created single answer question... while we try to hide this question, the termination is not working..
we need to hide this newly created question as well as the termination also needs to work..
can you please help ?
its working as you said..
But the respondent no need to see the newly created single answer question... while we try to hide this question, the termination is not working..
we need to hide this newly created question as well as the termination also needs to work..
can you please help ?
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12923
- Thank you received: 3977
4 years 4 months ago - 4 years 4 months ago #192035
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic how to auto tick an answer option based on previous question and hide remaining
I am not able to reproduce.
1. With this structure I do not see an issue.
M1 (multiple)
eqS1 (equation) (hidden) {S1=if(M1_SQ001=="Y" OR M1_SQ004=="Y",1,2)}
S1 (single) (hidden) answer option 1: proceed, 2: screenout
and quota: S1==2
2. It is not necessary to use the single punch question.
You may do it like this
M1 (multiple)
eqS1 (equation) (hidden) {if(M1_SQ001=="Y" OR M1_SQ004=="Y",1,2)}
and the quota on the equation: eqS1==2
Refer to the manual:
manual.limesurvey.org/Survey_quotas#Usin..._other_question_type
So this is up to you.
And if there are more questions you are asked to send a lss export of this part of your survey.
Joffm
1. With this structure I do not see an issue.
M1 (multiple)
eqS1 (equation) (hidden) {S1=if(M1_SQ001=="Y" OR M1_SQ004=="Y",1,2)}
S1 (single) (hidden) answer option 1: proceed, 2: screenout
and quota: S1==2
2. It is not necessary to use the single punch question.
You may do it like this
M1 (multiple)
eqS1 (equation) (hidden) {if(M1_SQ001=="Y" OR M1_SQ004=="Y",1,2)}
and the quota on the equation: eqS1==2
Refer to the manual:
manual.limesurvey.org/Survey_quotas#Usin..._other_question_type
So this is up to you.
And if there are more questions you are asked to send a lss export of this part of your survey.
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.