- Posts: 31
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Condition to display a question
- karld
- Topic Author
- Offline
- Junior Member
Less
More
3 years 2 weeks ago - 3 years 2 weeks ago #214513
by karld
Condition to display a question was created by karld
Hello,
This is a variation on the issue I had here: forums.limesurvey.org/forum/design-issue...array-5-point-choice
So, same version of LimeSurvey: 3.15.0+181008.
Respondents need to select 5 among the propositions for which they gave a 4 or 5 score in a serie of arrays (5 point choice) above in the questionnaire. If there are 5 of less answers with a 4 or 5 score, the question should not be shown, and all these answers should be selected.
See the attached questionnaire, there are 2 question groups:
- group 1 with all the propositions to be scores (5 point choice array)
- group 2 with the multiple choice question (q5) with the answers with a score or 4 or 5
Here is how group 1 looks like:
Here is what I want to be displayed for group 2 with more than 5 answers with a 4 or 5 score (nothing should be displayed if there are 5 or less answers with a 4 or 5 score):
What should I use as relevance equation for the multiple choice question (q5)?
I have tried to add a numerical input question (counter) in the group 1 and then an equation question (q10) in the group 2 with if() to add 1 to the counter variable if the answer was 4 of 5, but I had syntax problems:
q10 type equation content is as follows:
Calculate counter = number of answers with a score of 4 or 5 (then have relevance equation as counter>5)
{counter=0}
{if(q1_SQ001>3, counter=sum(counter,1))}
{if(q1_SQ002>3, counter=sum(counter,1))}
{if(q1_SQ003>3, counter=sum(counter,1))}
{if(q2_SQ001>3, counter=sum(counter,1))}
{if(q2_SQ002>3, counter=sum(counter,1))}
{if(q2_SQ003>3, counter=sum(counter,1))}
{if(q3_SQ001>3, counter=sum(counter,1))}
{if(q3_SQ002>3, counter=sum(counter,1))}
{if(q3_SQ003>3, counter=sum(counter,1))}
{if(q4_SQ001>3, counter=sum(counter,1))}
{if(q4_SQ002>3, counter=sum(counter,1))}
{if(q4_SQ003>3, counter=sum(counter,1))}
Any help greatly appreciated.
This is a variation on the issue I had here: forums.limesurvey.org/forum/design-issue...array-5-point-choice
So, same version of LimeSurvey: 3.15.0+181008.
Respondents need to select 5 among the propositions for which they gave a 4 or 5 score in a serie of arrays (5 point choice) above in the questionnaire. If there are 5 of less answers with a 4 or 5 score, the question should not be shown, and all these answers should be selected.
See the attached questionnaire, there are 2 question groups:
- group 1 with all the propositions to be scores (5 point choice array)
- group 2 with the multiple choice question (q5) with the answers with a score or 4 or 5
Here is how group 1 looks like:
Here is what I want to be displayed for group 2 with more than 5 answers with a 4 or 5 score (nothing should be displayed if there are 5 or less answers with a 4 or 5 score):
What should I use as relevance equation for the multiple choice question (q5)?
I have tried to add a numerical input question (counter) in the group 1 and then an equation question (q10) in the group 2 with if() to add 1 to the counter variable if the answer was 4 of 5, but I had syntax problems:
q10 type equation content is as follows:
Calculate counter = number of answers with a score of 4 or 5 (then have relevance equation as counter>5)
{counter=0}
{if(q1_SQ001>3, counter=sum(counter,1))}
{if(q1_SQ002>3, counter=sum(counter,1))}
{if(q1_SQ003>3, counter=sum(counter,1))}
{if(q2_SQ001>3, counter=sum(counter,1))}
{if(q2_SQ002>3, counter=sum(counter,1))}
{if(q2_SQ003>3, counter=sum(counter,1))}
{if(q3_SQ001>3, counter=sum(counter,1))}
{if(q3_SQ002>3, counter=sum(counter,1))}
{if(q3_SQ003>3, counter=sum(counter,1))}
{if(q4_SQ001>3, counter=sum(counter,1))}
{if(q4_SQ002>3, counter=sum(counter,1))}
{if(q4_SQ003>3, counter=sum(counter,1))}
Any help greatly appreciated.
Attachments:
Last edit: 3 years 2 weeks ago by karld.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12908
- Thank you received: 3975
3 years 2 weeks ago #214523
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Condition to display a question
Hi,
the buzzword is "countifop".
To count how many answers were there with score 4 or 5
{countifop(">","3",that.q1,that.q2,that.q3,that.q4)}
[url] manual.limesurvey.org/ExpressionScript_-...mplemented_functions [/url]
And what syntax error?
The red equal sign? this is a warning that you use an assiggnment, not a comparison.
Nevertheless:
I restructured it a bit and changed the second equation (I like thios more)
Joffm
the buzzword is "countifop".
To count how many answers were there with score 4 or 5
{countifop(">","3",that.q1,that.q2,that.q3,that.q4)}
[url] manual.limesurvey.org/ExpressionScript_-...mplemented_functions [/url]
And what syntax error?
The red equal sign? this is a warning that you use an assiggnment, not a comparison.
Nevertheless:
I restructured it a bit and changed the second equation (I like thios more)
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, karld
The topic has been locked.
- karld
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 31
- Thank you received: 2
3 years 2 weeks ago #214526
by karld
Replied by karld on topic Condition to display a question
Thank you very much, Joffm, it seems to work like a charm.
countifop, thanks for the pointing it to me.
countifop, thanks for the pointing it to me.
The topic has been locked.