- Posts: 7
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
How to array filter from Yes/No array question
- munmigraproject
- Topic Author
- Offline
- New Member
Less
More
3 months 2 days ago #254945
by munmigraproject
How to array filter from Yes/No array question was created by munmigraproject
Hi! Sorry if this has been answered previously, but I couldn't find an easy solution for this:
1. I have a Yes/No array question (Q1).
2. I want Q2 to also be a Yes/No array question, but the subquestions should only appear in case they were answered with a "Yes" in Q1.
Is there a way to do this simply (maybe without coding as I know nothing about this)?
Thank you so much!
Juliana
1. I have a Yes/No array question (Q1).
2. I want Q2 to also be a Yes/No array question, but the subquestions should only appear in case they were answered with a "Yes" in Q1.
Is there a way to do this simply (maybe without coding as I know nothing about this)?
Thank you so much!
Juliana
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12940
- Thank you received: 3979
3 months 2 days ago - 3 months 2 days ago #254948
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic How to array filter from Yes/No array question
You have to use subquestion relevance in your second array.
In Q2_SQ1: Q1_SQ1=="Y"
In Q2_SQ2: Q1_SQ2=="Y"
...
You could use array filter if Q1 was a multiple question, which is nearly the same as a Y/N array.
Joffm
In Q2_SQ1: Q1_SQ1=="Y"
In Q2_SQ2: Q1_SQ2=="Y"
...
You could use array filter if Q1 was a multiple question, which is nearly the same as a Y/N array.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 months 2 days ago by Joffm.
Please Log in to join the conversation.
- munmigraproject
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
3 months 2 days ago #254949
by munmigraproject
Replied by munmigraproject on topic How to array filter from Yes/No array question
Oh, this is super helpful, it worked! Such an easy solution, thanks a lot!
Please Log in to join the conversation.
- munmigraproject
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
2 months 3 weeks ago #255195
by munmigraproject
Replied by munmigraproject on topic How to array filter from Yes/No array question
Hi, can I make a follow-up question on this?
If Q1 is a simple array (not Yes/No), does the same logic apply? I'm trying to change "Y" (in Q2_SQ1: Q1_SQ1=="Y") to the answer option I have in Q1, but it's not working.
I could also use and Y/N array in Q1, but I don't know how to get rid of the "Unknown" column.
I hope this is clear, thank you!
If Q1 is a simple array (not Yes/No), does the same logic apply? I'm trying to change "Y" (in Q2_SQ1: Q1_SQ1=="Y") to the answer option I have in Q1, but it's not working.
I could also use and Y/N array in Q1, but I don't know how to get rid of the "Unknown" column.
I hope this is clear, thank you!
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12940
- Thank you received: 3979
2 months 3 weeks ago #255204
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic How to array filter from Yes/No array question
"It's not working" is not the best description of the issue.
Show exactly what you do!
Best you send the lss export of the survey.
Joffm
Show exactly what you do!
Best you send the lss export of the survey.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- munmigraproject
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
2 months 3 weeks ago #255206
by munmigraproject
Is the file attached what you mean? I really don't know much about technicalities, but I'll try to explain what I'm doing:
1. I have a QI (array type F) with several subquestions and 2 answer options (let's call them "Offered", "Not offered").
2. In QIa, which should also be an array type F-question, I want only the subquestions marked with "Offered" in QI to appear.
3. What should I do with QIa in order to do that? Add a condition? An array filter? A relevance equation for the subquestions?
Thank you!
Replied by munmigraproject on topic How to array filter from Yes/No array question
Is the file attached what you mean? I really don't know much about technicalities, but I'll try to explain what I'm doing:
1. I have a QI (array type F) with several subquestions and 2 answer options (let's call them "Offered", "Not offered").
2. In QIa, which should also be an array type F-question, I want only the subquestions marked with "Offered" in QI to appear.
3. What should I do with QIa in order to do that? Add a condition? An array filter? A relevance equation for the subquestions?
Thank you!
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12940
- Thank you received: 3979
2 months 3 weeks ago #255219
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic How to array filter from Yes/No array question
Hi,
As you may read here
[url] manual.limesurvey.org/ExpressionScript_-...s#Acceso_a_variables [/url]
QI_SQ001 returns the answer option code. Your codes are "AO01", "AO02" (why not simply "1" and "2"?)
But you compare with the answer option text. The texts are "Se ofreció" and "NO se ofreció"
So either you compare codes
QI_SQ001=="AO01"
or you compare texts
QI_SQ001.shown=="Se ofreció"
Always recommended to find out if you are not sure:
Activate the survey, enter some data and have a look at the response table
Or display the QCode in the question text (with curly brackets) and you see what is returned.
Joffm
Correct idea, wrong done.I'm trying to change "Y" (in Q2_SQ1: Q1_SQ1=="Y") to the answer option
As you may read here
[url] manual.limesurvey.org/ExpressionScript_-...s#Acceso_a_variables [/url]
QI_SQ001 returns the answer option code. Your codes are "AO01", "AO02" (why not simply "1" and "2"?)
But you compare with the answer option text. The texts are "Se ofreció" and "NO se ofreció"
So either you compare codes
QI_SQ001=="AO01"
or you compare texts
QI_SQ001.shown=="Se ofreció"
Always recommended to find out if you are not sure:
Activate the survey, enter some data and have a look at the response table
Or display the QCode in the question text (with curly brackets) and you see what is returned.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.