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
  • munmigraproject's Avatar Topic Author
  • Offline
  • New Member
  • New Member
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

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 days ago - 3 months 2 days ago #254948 by Joffm
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 

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
  • munmigraproject's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
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
  • munmigraproject's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
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!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 3 weeks ago #255204 by Joffm
"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 

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

Please Log in to join the conversation.

  • munmigraproject
  • munmigraproject's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 3 weeks ago #255206 by munmigraproject
Replied by munmigraproject on topic How to array filter from Yes/No array question
 

File Attachment:

File Name: limesurvey...7572.lss
File Size:450 KB


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
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 3 weeks ago #255219 by Joffm
Hi,

I'm trying to change "Y" (in Q2_SQ1: Q1_SQ1=="Y") to the answer option

Correct idea, wrong done.
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.

Lime-years ahead

Online-surveys for every purse and purpose