Welcome to the LimeSurvey Community Forum

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

Array filter with multiple choice

  • IngeborgNor
  • IngeborgNor's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #155175 by IngeborgNor
Array filter with multiple choice was created by IngeborgNor
I have tried to follow the explantion and the examples here:
manual.limesurvey.org/Question_type_-_Ar...r_.28array_filter.29

When I use Multiple short text it works as espected, but when I use Multiple choice it look like the attached screen shot.

What should I do to make the alternatives checked in the first question appear in the matrix below?
Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 9 months ago #155180 by tpartner
Replied by tpartner on topic Array filter with multiple choice
Can you attach a sample survey containing only those questions?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: IngeborgNor
The topic has been locked.
  • IngeborgNor
  • IngeborgNor's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #155182 by IngeborgNor
Replied by IngeborgNor on topic Array filter with multiple choice
Thank you for your quick response.

I tried to export it, is this ok?

File Attachment:

File Name: limesurvey...5185.lss
File Size:19 KB
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 9 months ago - 6 years 9 months ago #155183 by tpartner
Replied by tpartner on topic Array filter with multiple choice
For filtering to work, the sub-question codes in both questions must be identical.

Additionally, you can use an expression like this to display the answer text from the multiple-choice:
Code:
{Q1_SQ001.question}



Here is your survey back with:
- modified sub-question codes
- the new expressions for answer text
- relevance placed on the array so it only appears if there is at least one item selected in Q1.

File Attachment:

File Name: limesurvey...5185.lss
File Size:19 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 9 months ago by tpartner.
The following user(s) said Thank You: IngeborgNor, CranePassage
The topic has been locked.
  • IngeborgNor
  • IngeborgNor's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #155211 by IngeborgNor
Replied by IngeborgNor on topic Array filter with multiple choice
THANK YOU!! This was very educational :-)
The topic has been locked.
  • IngeborgNor
  • IngeborgNor's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago - 6 years 9 months ago #155214 by IngeborgNor
Replied by IngeborgNor on topic Array filter with multiple choice

tpartner wrote: - relevance placed on the array so it only appears if there is at least one item selected in Q1.


I have another question that is related, and I'm wondering if it's possible to do something similar with radio-list.

I need contact info of a number of institutions. So I use a text-array with name, email, phone in the columns. The problem is that I don't know the number of institutions.

Is it possible to do something like this:
  1. How many institutions do you have? (radiolist 1-20)
  2. Please give us the contact info of your institutions (text-array where the number of rows equals the answer in question 1)
Last edit: 6 years 9 months ago by IngeborgNor. Reason: misspell
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 9 months ago #155217 by tpartner
Replied by tpartner on topic Array filter with multiple choice
You can place relevance on the array rows (y-scale sub-questions) - see screenshot below.



Sample survey attached:

File Attachment:

File Name: limesurvey...8441.lss
File Size:21 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: IngeborgNor
The topic has been locked.
  • IngeborgNor
  • IngeborgNor's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #155256 by IngeborgNor
Replied by IngeborgNor on topic Array filter with multiple choice
Very nice! Thank you :)

Just to explain to anybody wondering about the same:

Make a list of numbers in the first question Q1. Make sure that the 'code' and the 'subquestion' is the same number. If you add a list of numbers by the Quick-add the code may automatically be 'A1' instead of '1'.

In the second question (Q2) you set the relevance to !is_empty(Q1) and the relevance in the subquestion as in the image in the above post.
The topic has been locked.
More
6 years 9 months ago #155735 by BBCMResearch
Replied by BBCMResearch on topic Array filter with multiple choice
Tony,

If I had a similar setup but with a multiple choice with text instead of regular multiple choice as the first question, what would i type in the filtered subquestions to call whatever was input into the text, rather than the subquestion itself?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 9 months ago #155768 by tpartner
Replied by tpartner on topic Array filter with multiple choice
For example, given a question code "Q1" and a sub-question code "SQ001", to access the comment value, use this:

Code:
{Q1_SQ001comment}

So, if you wanted to filter a following question or sub-question so it only appears if there is a comment, use something like this

Code:
!is_empty(Q1_SQ001comment)

More on variable naming - manual.limesurvey.org/Expression_Manager#Qcode_Variable_Naming

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
6 years 9 months ago #155789 by BBCMResearch
Replied by BBCMResearch on topic Array filter with multiple choice
Thanks!
The topic has been locked.
  • IngeborgNor
  • IngeborgNor's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #155947 by IngeborgNor
Replied by IngeborgNor on topic Array filter with multiple choice

tpartner wrote: For example, given a question code "Q1" and a sub-question code "SQ001", to access the comment value, use this:

Code:
{Q1_SQ001comment}

So, if you wanted to filter a following question or sub-question so it only appears if there is a comment, use something like this

Code:
!is_empty(Q1_SQ001comment)

More on variable naming - manual.limesurvey.org/Expression_Manager#Qcode_Variable_Naming



I feel really stupid, but I just don't get this.

I have a 'Multiple choice list' with the option of 'other' last on the list. The code of this question is 'scenarioer'.

I have a an Array where the subquestions are based on 'scenarioer', code ' scenarioROS'. It works as expected with the prewritten options, but not with 'other'. The other-row of the array is visible no matter if the other-option was ticked or not.

I have tried to edit the 'Relevance equation', but no mater what I put there, the other-row is visible.


How can I make sure that the other-row only show up if people has written something in the other-field?
Attachments:
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose