Welcome to the LimeSurvey Community Forum

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

Filtering questions based off a single column in an Array (Text)

  • Racheltownsend1
  • Racheltownsend1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 3 months ago #177131 by Racheltownsend1
Below is a pic of what I am trying to do.

I am trying to figure out how to get the sub-questions in Q2d to filter based off of columns 3 (pyrosequencing) and 7 (send out) only. The way I have it now, it is filtering off of all columns that have a check mark.

So, for Q2d to show up the way I want it to, only Gastrointestinal Stromal Tumors and Glioblastoma would show up.

Any idea what code I need to enter under the filter field in order to filter just the sub-questions that have check marks in columns 3 and/or 7?

The topic has been locked.
More
5 years 3 months ago #177132 by jelo
Attach a survey with the relevant questions as an LSS export here to this thread.
What version of LimeSurvey is used?


The questiontype looks like Array (Numbers) with Checkbox style.
The access of these variables are
Questioncode_YAXISanswercode_XAXISanserscode.NAOK

E.g. qa_SQY01_SQX01.NAOK
when qa is the questioncode
when Y-Axiscodes are SQY01, SQY02 etc.
when X-Axiscodes are SQX01, SQX02 etc.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • Racheltownsend1
  • Racheltownsend1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 3 months ago #177134 by Racheltownsend1
Thank you for your help, Jelo. I am a new user, and I am not a coder, so I have a lot to learn.


I am using Version 3.15.1+181017

The file you requested is attached.

Right now I just have the filter set to Q2, which is why it is pulling any answer that is checked. I tried entering different things, like ! is_empty(Q2_SQ001_SQ001), in the filter field, but I still couldn't get it to work right. I'm not sure what the correct way is to identify a checked box in a certain column.
The topic has been locked.
More
5 years 3 months ago #177139 by jelo
You seem to use an arrayfilter instead of subquestion relevance.

Remove all conditions or relevance from a question and then begin to experiment with subquestionrelevance.



Instead of 1 you write relevance with ExpressionScript (still labled ExpressionManager).

E.g. !is_empty(Q2_SQ001_SQ007.NAOK) etc.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 3 months ago #177147 by DenisChenu
I move this topic : totally unrelated to Development

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • Racheltownsend1
  • Racheltownsend1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 3 months ago - 5 years 3 months ago #177191 by Racheltownsend1
Thanks for your help, Jelo. I was finally able to figure it out after you pointed me in the right direction. Not sure if it's the best way to do it, but at least it works!

Thought I'd post pics of what I did just in case anyone else ever needs help with the same issue.

Step 1 - enter a relevance equation for Q2b (question 2b) so the question only shows up if subquestions in columns 3 or 7 are selected.
Step 2 - in the filter field, enter question code for the question I want to filter (Q2)
Step 3 - enter relevance equations for each subquestion for Q2b so only the subquestions in columns 3 or 7 show up when selected.

Step 1 image:




Step 2 image:


Step 3 image:
Last edit: 5 years 3 months ago by Racheltownsend1.
The topic has been locked.
More
5 years 3 months ago #177192 by jelo

Racheltownsend1 wrote: Thanks for your help, Jelo. I was finally able to figure it out after you pointed me in the right direction. Not sure if it's the best way to do it, but at least it works!


Did you try it with just step3 first? Without question relevance and arrayfilter the question should only be shown if one of the subquestions are with relevance. I didn't checked it, so LimeSurvey might not that clever and an empty question would be shown.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • Racheltownsend1
  • Racheltownsend1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 3 months ago #177193 by Racheltownsend1
Yes, I did try it with just Step 3 first, but if I do that then Question Q2d always shows up - pic below. Since I only want Q2d to show up if columns 3 or 7 are selected, I had to put a relevance equation for Q2d, as well.

Out of curiosity, I did go back and delete Q2 from the filter field to see if that changed anything. It doesn't seem to matter if the filter code is there or not, so I guess that step can be skipped.

Attachments:
The topic has been locked.
More
5 years 3 months ago #177196 by jelo
I tried to reproduce the issue that a question is shown, when all subquestion are having a relevance of 0.

Looks fine under 3.15.5. for me.



Every subquestion with a relevance of 0 and complete question is hidden.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose