- Posts: 111
- Thank you received: 20
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Does matrix filter support EM?
- orvil
- Topic Author
- Offline
- Premium Member
Less
More
10 years 6 days ago - 10 years 6 days ago #107677
by orvil
Best regards/Beste Grüße,
O. Villani
Does matrix filter support EM? was created by orvil
Hi,
currently I'm trying to use an expression for a matrix filter. Is this supported by LS?
An example:
1) Question A is a simple two way choice like Y/N
1) Questions B and C, both are multiple selections, same subquestions SQ001, SQ002, ... of course
2) Questions D is a matrix question, again with subquestions named SQ001, SQ002, ...
Now I'd like to have the subquestion of question D being filtered either by question B or question C depending on question A with an expression like:
if(questionA == "Y",questionB, questionC)
witch means "use questionB as matrix filter for question D if questionA is "Y". Otherwise use questionC as matrix filter for questionD"
Any ideas???
thx in advance
currently I'm trying to use an expression for a matrix filter. Is this supported by LS?
An example:
1) Question A is a simple two way choice like Y/N
1) Questions B and C, both are multiple selections, same subquestions SQ001, SQ002, ... of course
2) Questions D is a matrix question, again with subquestions named SQ001, SQ002, ...
Now I'd like to have the subquestion of question D being filtered either by question B or question C depending on question A with an expression like:
if(questionA == "Y",questionB, questionC)
witch means "use questionB as matrix filter for question D if questionA is "Y". Otherwise use questionC as matrix filter for questionD"
Any ideas???
thx in advance
Best regards/Beste Grüße,
O. Villani
Last edit: 10 years 6 days ago by orvil.
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 227
- Thank you received: 36
10 years 6 days ago #107680
by first
Survey Designer and Programmer
Replied by first on topic Does matrix filter support EM?
Step1:Create an equation type question (eq) after question C.
Step2:Create a multi question (D) after question eq with the same answer list and A and B.
Step3: Use D as Array filter .
step4:Hide D from question settings
Step 5: Write below equation in eq.
{D_SQ001=if((('B_SQ001.NAOK' == 'Y')||('C_SQ001.NAOK' == 'Y')),'Y','')}
I have not tested the above equation but I sure you got the idea.
Step2:Create a multi question (D) after question eq with the same answer list and A and B.
Step3: Use D as Array filter .
step4:Hide D from question settings
Step 5: Write below equation in eq.
{D_SQ001=if((('B_SQ001.NAOK' == 'Y')||('C_SQ001.NAOK' == 'Y')),'Y','')}
I have not tested the above equation but I sure you got the idea.
Survey Designer and Programmer
The following user(s) said Thank You: orvil
The topic has been locked.
- orvil
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 111
- Thank you received: 20
10 years 6 days ago #107693
by orvil
Best regards/Beste Grüße,
O. Villani
Replied by orvil on topic Does matrix filter support EM?
Hello,
thanks I see your approach and it's surely working well. But unfortunately this does not solve my problem.
The example I gave was only a brief abstraction. That is why I belive I need to directly adress different questions (or in some cases none) within the array filter field (of question D in my example).
To be more detailed, I do have:
-a question A (it is in reality an equation giving a number between 1 and 25)
-a question B (it is a hidden multiple selection with 5 subquestions SQ001 to SQ005 and depending on A the subquestions are filled by an EM with 1 or they are empty)
-a question C (same like B, other EM formula) - maybe I can dispense this question, dont know at the moment
- at last: 5 questions D (D1, D2, ..., D5 all with 5 subquestions SQ001 to SQ005
Now: Depending on the result of A (a value between 1 to 25) only a part of the 5 D-questions are shown
if A <= 5 only D1
if A <= 11 D1 and D2
if A <= 16 D1, D2 and D3
if A <= 20 D1, D2, D3 an D4
if A > 20 all (D1,D2,D3,D5,D5) are shown
The point is: only the LAST ONE of the D's has to be filtered by question C, all other (i.e. D1 to D(n-1) ) has to be filtered by question B (or may be I will not need any filter for these not-the-last ones).
So for example:
if result of A == 14 then
D1 and D2 has to be filtered by question B (or may be not being filtered)
D3 has to be filtered by question C
(D4 and D5 are not visible by relevance equation)
Another example:
if result of A == 22
D1, D2, D3, D4 has to be filtered by question B (or may be not being filtered)
D5 has to be filtered by question C
A little bit complicated, kind of brainteaser, I know :woohoo:
thanks I see your approach and it's surely working well. But unfortunately this does not solve my problem.
The example I gave was only a brief abstraction. That is why I belive I need to directly adress different questions (or in some cases none) within the array filter field (of question D in my example).
To be more detailed, I do have:
-a question A (it is in reality an equation giving a number between 1 and 25)
-a question B (it is a hidden multiple selection with 5 subquestions SQ001 to SQ005 and depending on A the subquestions are filled by an EM with 1 or they are empty)
-a question C (same like B, other EM formula) - maybe I can dispense this question, dont know at the moment
- at last: 5 questions D (D1, D2, ..., D5 all with 5 subquestions SQ001 to SQ005
Now: Depending on the result of A (a value between 1 to 25) only a part of the 5 D-questions are shown
if A <= 5 only D1
if A <= 11 D1 and D2
if A <= 16 D1, D2 and D3
if A <= 20 D1, D2, D3 an D4
if A > 20 all (D1,D2,D3,D5,D5) are shown
The point is: only the LAST ONE of the D's has to be filtered by question C, all other (i.e. D1 to D(n-1) ) has to be filtered by question B (or may be I will not need any filter for these not-the-last ones).
So for example:
if result of A == 14 then
D1 and D2 has to be filtered by question B (or may be not being filtered)
D3 has to be filtered by question C
(D4 and D5 are not visible by relevance equation)
Another example:
if result of A == 22
D1, D2, D3, D4 has to be filtered by question B (or may be not being filtered)
D5 has to be filtered by question C
A little bit complicated, kind of brainteaser, I know :woohoo:
Best regards/Beste Grüße,
O. Villani
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 227
- Thank you received: 36
10 years 5 days ago #107697
by first
Survey Designer and Programmer
Replied by first on topic Does matrix filter support EM?
Please create this situation in a test survey and attach lss here. I will try to help.
Survey Designer and Programmer
The topic has been locked.
- orvil
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 111
- Thank you received: 20
10 years 5 days ago #107702
by orvil
Best regards/Beste Grüße,
O. Villani
Replied by orvil on topic Does matrix filter support EM?
Hello,
did so. Hope it is self explaining
did so. Hope it is self explaining
Best regards/Beste Grüße,
O. Villani
Attachments:
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 227
- Thank you received: 36
10 years 5 days ago - 10 years 5 days ago #107708
by first
Survey Designer and Programmer
Replied by first on topic Does matrix filter support EM?
Solution:-
Create questionB for each questionD.
Update each questionB in array filter of questionD.
Only show questionB corresponding to last questionD.
We can also do it with java script.
Create questionB for each questionD.
Update each questionB in array filter of questionD.
Only show questionB corresponding to last questionD.
We can also do it with java script.
Survey Designer and Programmer
Last edit: 10 years 5 days ago by first.
The topic has been locked.
- orvil
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 111
- Thank you received: 20
10 years 5 days ago #107709
by orvil
Best regards/Beste Grüße,
O. Villani
Replied by orvil on topic Does matrix filter support EM?
Hi Trivender,
creating a filter question for every questionD is what I'd really like to avoid - because of the resulting database size => every filter subquestion leads to one more field . Ideally I'd like to avoid as much datafields as possible.
So JavaScript is may be another approach. Are there any js-only solutions jet? Found something in the js workarounds, but not matching the subquestions problem as far as I can understand the code.
creating a filter question for every questionD is what I'd really like to avoid - because of the resulting database size => every filter subquestion leads to one more field . Ideally I'd like to avoid as much datafields as possible.
So JavaScript is may be another approach. Are there any js-only solutions jet? Found something in the js workarounds, but not matching the subquestions problem as far as I can understand the code.
Best regards/Beste Grüße,
O. Villani
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 227
- Thank you received: 36
10 years 5 days ago #107711
by first
Survey Designer and Programmer
Replied by first on topic Does matrix filter support EM?
Save below code in source of questionB and let me know how it looks.
Survey Designer and Programmer
The following user(s) said Thank You: orvil
The topic has been locked.
- orvil
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 111
- Thank you received: 20
10 years 4 days ago #107716
by orvil
Best regards/Beste Grüße,
O. Villani
Replied by orvil on topic Does matrix filter support EM?
Hi Trivender,
works great if questions are in the same group and shown group by group. THANKS!
Is it possible to use your tweak if questions are show in question by question mode too? (as you may see my jquery knowledge is poor :blush: )
works great if questions are in the same group and shown group by group. THANKS!
Is it possible to use your tweak if questions are show in question by question mode too? (as you may see my jquery knowledge is poor :blush: )
Best regards/Beste Grüße,
O. Villani
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 227
- Thank you received: 36
10 years 4 days ago #107745
by first
Survey Designer and Programmer
Replied by first on topic Does matrix filter support EM?
I think we can do it even if questions are on different page . If you can create a desired test survey and attach lss here I will try.
Survey Designer and Programmer
The topic has been locked.
- orvil
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 111
- Thank you received: 20
10 years 3 days ago #107818
by orvil
Best regards/Beste Grüße,
O. Villani
Replied by orvil on topic Does matrix filter support EM?
hello,
would be really great if this is possible!
THX
would be really great if this is possible!
THX
Best regards/Beste Grüße,
O. Villani
Attachments:
The topic has been locked.
- orvil
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 111
- Thank you received: 20
10 years 20 hours ago #107934
by orvil
Best regards/Beste Grüße,
O. Villani
Replied by orvil on topic Does matrix filter support EM?
No idea so far? Could not find a js solution too.
So I'll try to write a patch. Any hints where in the code I can start?
So I'll try to write a patch. Any hints where in the code I can start?
Best regards/Beste Grüße,
O. Villani
The topic has been locked.