- Posts: 4
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Sum / count multiple choice
- ljanka
- Topic Author
- Offline
- New Member
Less
More
11 years 10 months ago #82095
by ljanka
Sum / count multiple choice was created by ljanka
I have a problem, I tell it with the example:
Q1 is a multiple choice question, with subQ 1,2,3....
I want to only ask Q2 (multiple choice, array filter: Q1) from people who checked minimum 2 answer. (so if you checked only 1 in Q1, jump the queston).
I tried the following:
Relevance equation:
sum(Q1_1,Q1_2,Q1_3,...,Q1_n)>1
But it doesn"t want to work.
And I have Version 1.92+ Build 120608, the newest.
Anyone can help me?
Thanks a lot!
Q1 is a multiple choice question, with subQ 1,2,3....
I want to only ask Q2 (multiple choice, array filter: Q1) from people who checked minimum 2 answer. (so if you checked only 1 in Q1, jump the queston).
I tried the following:
Relevance equation:
sum(Q1_1,Q1_2,Q1_3,...,Q1_n)>1
But it doesn"t want to work.
And I have Version 1.92+ Build 120608, the newest.
Anyone can help me?
Thanks a lot!
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
11 years 10 months ago #82100
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Sum / count multiple choice
Try:
Code:
sum((Q1_1 == 'Y'), (Q1_2 == 'Y'), (Q1_3 == 'Y'),...(Q1_n == 'Y')) > 1
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- TMSWhite
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 44
- Thank you received: 15
11 years 10 months ago #82103
by TMSWhite
If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser .
Replied by TMSWhite on topic Sum / count multiple choice
Another option is:
Code:
count(Q1_1, Q1_2, Q1_3, ..., Q1_n) > 1
If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser .
- Expression Manager (EM):
Documentation
|
Sample Surveys
|
How Tos
|
Show Logic File
|
Upgrading to 1.92+ - Excel Style for Survey Structure Import/Export
The topic has been locked.
- ljanka
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
11 years 10 months ago #82123
by ljanka
Replied by ljanka on topic Sum / count multiple choice
Thanks for you answers.
I tried it in my survey, but it didn't want to work
But, your formulas are good, I tested it in a small "test" survey wth only 2 questions. Both formulas worked well, as I need it.
So I really don't understand, why it doesn't work in my real survey. In that survey the question has 26 subquestions (anwer options). Could it be the problem, the too many subquestions?
I tried it in my survey, but it didn't want to work
But, your formulas are good, I tested it in a small "test" survey wth only 2 questions. Both formulas worked well, as I need it.
So I really don't understand, why it doesn't work in my real survey. In that survey the question has 26 subquestions (anwer options). Could it be the problem, the too many subquestions?
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
11 years 10 months ago #82124
by Mazi
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic Sum / count multiple choice
Too many options shouldn't be the problem.
Please attach your question group for testing.
Please attach your question group for testing.
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
- ljanka
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
11 years 10 months ago #82188
by ljanka
Replied by ljanka on topic Sum / count multiple choice
I attached the survey (I copied into a new one, the questions).
There are some array filter. Do they can modify the validation?
I tried these validation equations:
count(Q17_1, Q17_2, Q17_3, Q17_4, Q17_5, Q17_6, Q17_7, Q17_8, Q17_9, Q17_10, Q17_11, Q17_12, Q17_13, Q17_14, Q17_15, Q17_16, Q17_17, Q17_18, Q17_19, Q17_20, Q17_21, Q17_22, Q17_23, Q17_24, Q17_25, Q17_26) > 1
sum((Q17_1 == 'Y'), (Q17_2 == 'Y'), (Q17_3 == 'Y'), (Q17_4 == 'Y'), (Q17_5 == 'Y'), (Q17_6 == 'Y'), (Q17_7 == 'Y'), (Q17_8 == 'Y'), (Q17_9 == 'Y'), (Q17_10 == 'Y'), (Q17_11 == 'Y'), (Q17_12 == 'Y'), (Q17_13 == 'Y'), (Q17_14 == 'Y'), (Q17_15 == 'Y'), (Q17_16 == 'Y'), (Q17_17 == 'Y'), (Q17_18 == 'Y'), (Q17_19 == 'Y'), (Q17_20 == 'Y'), (Q17_21 == 'Y'), (Q17_22 == 'Y'), (Q17_23 == 'Y'), (Q17_24 == 'Y'), (Q17_25 == 'Y'), (Q17_26 == 'Y')) > 1
And I really don't understand why it doesn't work, because I tested it another small survey and both method were excellent...
Could you help me?
There are some array filter. Do they can modify the validation?
I tried these validation equations:
count(Q17_1, Q17_2, Q17_3, Q17_4, Q17_5, Q17_6, Q17_7, Q17_8, Q17_9, Q17_10, Q17_11, Q17_12, Q17_13, Q17_14, Q17_15, Q17_16, Q17_17, Q17_18, Q17_19, Q17_20, Q17_21, Q17_22, Q17_23, Q17_24, Q17_25, Q17_26) > 1
sum((Q17_1 == 'Y'), (Q17_2 == 'Y'), (Q17_3 == 'Y'), (Q17_4 == 'Y'), (Q17_5 == 'Y'), (Q17_6 == 'Y'), (Q17_7 == 'Y'), (Q17_8 == 'Y'), (Q17_9 == 'Y'), (Q17_10 == 'Y'), (Q17_11 == 'Y'), (Q17_12 == 'Y'), (Q17_13 == 'Y'), (Q17_14 == 'Y'), (Q17_15 == 'Y'), (Q17_16 == 'Y'), (Q17_17 == 'Y'), (Q17_18 == 'Y'), (Q17_19 == 'Y'), (Q17_20 == 'Y'), (Q17_21 == 'Y'), (Q17_22 == 'Y'), (Q17_23 == 'Y'), (Q17_24 == 'Y'), (Q17_25 == 'Y'), (Q17_26 == 'Y')) > 1
And I really don't understand why it doesn't work, because I tested it another small survey and both method were excellent...
Could you help me?
Attachments:
The topic has been locked.
- ljanka
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
11 years 10 months ago #82192
by ljanka
Replied by ljanka on topic Sum / count multiple choice
OMG
After clicking a lot in limesurvey, I found my problem what I didn't recognize before, I used ' symbol, and the right one is, the double ".....
So thanks for your help !!!
After clicking a lot in limesurvey, I found my problem what I didn't recognize before, I used ' symbol, and the right one is, the double ".....
So thanks for your help !!!
The topic has been locked.
- TMSWhite
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 44
- Thank you received: 15
11 years 10 months ago #82200
by TMSWhite
If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser .
Replied by TMSWhite on topic Sum / count multiple choice
Since you are using Array Filter, you need to use the following equation:
The .NAOK suffix is only needed in equations where one or more variables might be irrelevant (e.g. not shown due to conditions and/or array filtering). In general, if any variables are irrelevant, the entire equation is irrelevant. To over-ride that behavior, use the .NAOK suffix.
Examples and documentation of .NAOK can be found here and here .
Code:
count(Q17_1.NAOK, Q17_2.NAOK, Q17_3.NAOK, Q17_4.NAOK, Q17_5.NAOK, Q17_6.NAOK, Q17_7.NAOK, Q17_8.NAOK, Q17_9.NAOK, Q17_10.NAOK, Q17_11.NAOK, Q17_12.NAOK, Q17_13.NAOK, Q17_14.NAOK, Q17_15.NAOK, Q17_16.NAOK, Q17_17.NAOK, Q17_18.NAOK, Q17_19.NAOK, Q17_20.NAOK, Q17_21.NAOK, Q17_22.NAOK, Q17_23.NAOK, Q17_24.NAOK, Q17_25.NAOK, Q17_26.NAOK) > 1
The .NAOK suffix is only needed in equations where one or more variables might be irrelevant (e.g. not shown due to conditions and/or array filtering). In general, if any variables are irrelevant, the entire equation is irrelevant. To over-ride that behavior, use the .NAOK suffix.
Examples and documentation of .NAOK can be found here and here .
If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser .
- Expression Manager (EM):
Documentation
|
Sample Surveys
|
How Tos
|
Show Logic File
|
Upgrading to 1.92+ - Excel Style for Survey Structure Import/Export
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
11 years 10 months ago #82264
by Mazi
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic Sum / count multiple choice
Tom, does it really make a difference if you use ((q1=="2")) or ((q2=='2'))? Can't one use both kind of quotes?ljanka wrote: OMG
After clicking a lot in limesurvey, I found my problem what I didn't recognize before, I used ' symbol, and the right one is, the double ".....
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
- TMSWhite
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 44
- Thank you received: 15
11 years 10 months ago #82275
by TMSWhite
If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser .
Replied by TMSWhite on topic Sum / count multiple choice
Mazi-
You should be able to mix the types of quotes. The root issue is that this was a case where the .NAOK suffix was needed.
So, I'm not sure what that OMG comment meant.
You should be able to mix the types of quotes. The root issue is that this was a case where the .NAOK suffix was needed.
So, I'm not sure what that OMG comment meant.
If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser .
- Expression Manager (EM):
Documentation
|
Sample Surveys
|
How Tos
|
Show Logic File
|
Upgrading to 1.92+ - Excel Style for Survey Structure Import/Export
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
11 years 10 months ago - 11 years 10 months ago #82283
by Mazi
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic Sum / count multiple choice
Thanks for clarifying, Tom!
Is there any reason why one shouldn't always use ".NAOK" for all expressions?
Is there any reason why one shouldn't always use ".NAOK" for all expressions?
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Last edit: 11 years 10 months ago by Mazi.
The topic has been locked.
- TMSWhite
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 44
- Thank you received: 15
11 years 9 months ago #83005
by TMSWhite
There is also a shortcut so that you don't have to write such long equations. You can use the following:
or (to refer to Q17 from a different question, such as to only display Q18 if at least two questions from Q17 were answered):
Both of these will be auto-expanded to the longer equation shown. Documentation about this feature is found here .
If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser .
Replied by TMSWhite on topic Sum / count multiple choice
TMSWhite wrote: Since you are using Array Filter, you need to use the following equation:
Code:count(Q17_1.NAOK, Q17_2.NAOK, Q17_3.NAOK, Q17_4.NAOK, Q17_5.NAOK, Q17_6.NAOK, Q17_7.NAOK, Q17_8.NAOK, Q17_9.NAOK, Q17_10.NAOK, Q17_11.NAOK, Q17_12.NAOK, Q17_13.NAOK, Q17_14.NAOK, Q17_15.NAOK, Q17_16.NAOK, Q17_17.NAOK, Q17_18.NAOK, Q17_19.NAOK, Q17_20.NAOK, Q17_21.NAOK, Q17_22.NAOK, Q17_23.NAOK, Q17_24.NAOK, Q17_25.NAOK, Q17_26.NAOK) > 1
There is also a shortcut so that you don't have to write such long equations. You can use the following:
Code:
count(self.NAOK) > 1
or (to refer to Q17 from a different question, such as to only display Q18 if at least two questions from Q17 were answered):
Code:
count(that.Q17.NAOK) > 1
Both of these will be auto-expanded to the longer equation shown. Documentation about this feature is found here .
If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser .
- Expression Manager (EM):
Documentation
|
Sample Surveys
|
How Tos
|
Show Logic File
|
Upgrading to 1.92+ - Excel Style for Survey Structure Import/Export
The topic has been locked.