- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Screen out based on multiple questions - not able to calculate score
- socrates
- Topic Author
- Offline
- New Member
Less
More
7 years 8 months ago #138368
by socrates
Screen out based on multiple questions - not able to calculate score was created by socrates
Hi!
I'm getting lost with the attempt to calculate a score based on a multiple question to screen out respondents. I researched a lot in the forum , but couldn't replicate what I found. I understand that I need to calculate a score with the help of an equation question and with another equation setting a certain value to a list question to be able to set a quota.
Say I want ask people what sports they are doing (Multiple choice) and only continuing the survey with those who do certain sports.
1. Therefore I assigned a code value of say 100 to "Jogging" and 50 to "Skiing"
2. Now: if I want the Survey to be continued with Joggers only I manage to get with an equation a score of 100 by the following {if(Q1_100,100,0)}, however I'm not able to write the right expression that calculates the sum of all codes that are checked in Q1? How would I do this?
3. To screen out all that are non-Joggers or non-skier I tried as I found in the forum with the forum with another equation: {Q2=if(SQ1 > 49, "1", "2")} but this doesn't set the values in Q2 as I thought it should.
Any idea what's wrong? See attached the short .lss file
Thanks!
I'm getting lost with the attempt to calculate a score based on a multiple question to screen out respondents. I researched a lot in the forum , but couldn't replicate what I found. I understand that I need to calculate a score with the help of an equation question and with another equation setting a certain value to a list question to be able to set a quota.
Say I want ask people what sports they are doing (Multiple choice) and only continuing the survey with those who do certain sports.
1. Therefore I assigned a code value of say 100 to "Jogging" and 50 to "Skiing"
2. Now: if I want the Survey to be continued with Joggers only I manage to get with an equation a score of 100 by the following {if(Q1_100,100,0)}, however I'm not able to write the right expression that calculates the sum of all codes that are checked in Q1? How would I do this?
3. To screen out all that are non-Joggers or non-skier I tried as I found in the forum with the forum with another equation: {Q2=if(SQ1 > 49, "1", "2")} but this doesn't set the values in Q2 as I thought it should.
Any idea what's wrong? See attached the short .lss file
Thanks!
Attachments:
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1223
- Thank you received: 351
7 years 8 months ago #138372
by Ben_V
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Screen out based on multiple questions - not able to calculate score
1. & 2. You can compute Q1 score in an intermediate equation type question (Qscore) using something like:
3. Use as Q2 question text:
BTW you can do the same more directly avoiding additional Qscore equation:
Code:
{sum(if(Q1_100=="Y",100,0),if(Q1_50=="Y",50,0))}
3. Use as Q2 question text:
Code:
{if(Qscore > 49, "1", "2")}
BTW you can do the same more directly avoiding additional Qscore equation:
Code:
{if( sum(if(Q1_100=="Y",100,0),if(Q1_50=="Y",50,0)) > 49, "1", "2")}
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
- socrates
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
7 years 8 months ago #138378
by socrates
Replied by socrates on topic Screen out based on multiple questions - not able to calculate score
This is brilliant. Thank you.
The only stuggle left: To screen out I would have in Q2 code 1 or 2 be set as "Yes", so I could set a 0 quota.
However, if I follow your recommendation I get in Q2 as question text 1 or 2, but obviously that won't help me to screen out.
What am I missing?
Thanks so much!
The only stuggle left: To screen out I would have in Q2 code 1 or 2 be set as "Yes", so I could set a 0 quota.
However, if I follow your recommendation I get in Q2 as question text 1 or 2, but obviously that won't help me to screen out.
What am I missing?
Thanks so much!
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1223
- Thank you received: 351
7 years 8 months ago #138380
by Ben_V
For this I don't use quotas but just a conditional javascript redirection, pasted in the source of the next group group's description (check survey settings if group description visibility is on)
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Screen out based on multiple questions - not able to calculate score
socrates wrote: To screen out I would have in Q2 code 1 or 2 be set as "Yes", so I could set a 0 quota.
However, if I follow your recommendation I get in Q2 as question text 1 or 2, but obviously that won't help me to screen out.!
For this I don't use quotas but just a conditional javascript redirection, pasted in the source of the next group group's description (check survey settings if group description visibility is on)
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var qCondition = '{Q2}'; if( qCondition == 1) { $('body').hide(); window.location = "http://example.org"; }; }); </script>
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
- socrates
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
7 years 8 months ago #138409
by socrates
Replied by socrates on topic Screen out based on multiple questions - not able to calculate score
Thanks Benoit. This is clearly the advanced mode (and I'm not entirely sure I'll get it done this way).
Nevertheless as a matter of interest:
My equation question is with your help defined to give me either a 1 or a 2 as a result - so far so clear.
How can I then make sure that my subsequent question has a default value automatically either code 1 or code 2 checked depending on the result of my equation question.
My thinking was that by doing so I could use also the quota function in the survey settings to screen out to keep better overview.
So the logic must be somehting like if SQ1=1, Q2_1 = Y, but this seems to not work.
Thanks again for your support
Nevertheless as a matter of interest:
My equation question is with your help defined to give me either a 1 or a 2 as a result - so far so clear.
How can I then make sure that my subsequent question has a default value automatically either code 1 or code 2 checked depending on the result of my equation question.
My thinking was that by doing so I could use also the quota function in the survey settings to screen out to keep better overview.
So the logic must be somehting like if SQ1=1, Q2_1 = Y, but this seems to not work.
Thanks again for your support
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1223
- Thank you received: 351
7 years 8 months ago - 7 years 8 months ago #138410
by Ben_V
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Screen out based on multiple questions - not able to calculate score
I'm not a quota expert but as far as i know you can't set quota based on an equation question... that's why I simply use javascript. Note that it's ok because screen out are just quota with "0" value; It's not possible to use this trick for "real" quotas with value > 0 (and have to apply some count)
You can easily enhance/adapt the provided js code to fit your needs.. For example:
You can easily enhance/adapt the provided js code to fit your needs.. For example:
Code:
.... if ( ( qCondition == 1) || ( qCondition == 2) ) { ....
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 7 years 8 months ago by Ben_V.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
7 years 8 months ago #138548
by DenisChenu
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.
Replied by DenisChenu on topic Screen out based on multiple questions - not able to calculate score
In fact : you can set a quota with Equation :
Use 2 question : one "single choice" + one equation.
The quota is done with single choice question
Equation :
QUOTA={if ( ( qCondition == 1) || ( qCondition == 2) ),"OUT","OK")}
Use 2 question : one "single choice" + one equation.
The quota is done with single choice question
Equation :
QUOTA={if ( ( qCondition == 1) || ( qCondition == 2) ),"OUT","OK")}
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.