Welcome to the LimeSurvey Community Forum

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

Multiple choice question and assesment sum/count

  • Jenska
  • Jenska's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 months 4 weeks ago #251641 by Jenska
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hello!

I'm trying to make a test/quiz and I have some multiple choice questions.

So I want to add up scores of the entire test, but at the moment the program only calculates other questions that are not multiple choice questions.

Example:

Answer 1  (1 point)
Answer 2  (0 point)
Answer 3  (1 point)
Answer 4  (0 point)
Answer 5  (1 point)
Answer 6  (0 point)

I have this kind of code at question's logic part:

countif(( em7_SQ001.NAOK == 'Y'), ( em7_SQ003.NAOK == 'Y'), ( em7_SQ005.NAOK == 'Y')) >1


I really don't know what I'm doing wrong here.

Please help!

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 4 weeks ago - 5 months 4 weeks ago #251649 by tpartner
countif('Y', em7_SQ001.NAOK, em7_SQ003.NAOK, em7_SQ005.NAOK)

manual.limesurvey.org/ExpressionScript_-...#Access_to_functions

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 months 4 weeks ago by tpartner.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 4 weeks ago #251650 by Joffm
Simply "wrong syntax"

The manual explains:
"countif"
Count the number of answered questions in the list equal to the first argument
countif(matches, arg1, arg2, ... argN)
Meaning: countif('Y', em7_SQ001.NAOK, em7_SQ003.NAOK, em7_SQ005.NAOK)

and 
"count" (what is suffiicient in your case)
count the number of answered (non-blank) questions in the list
count(arg1, arg12, ..., argN)

Meaning: count( em7_SQ001.NAOK, em7_SQ003.NAOK, em7_SQ005.NAOK)
Because: If it is selected, it is answered else not answered

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • Jenska
  • Jenska's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 months 4 weeks ago #251651 by Jenska
Well this didn't work eather.

I have related questions:

Is "question" part the right place to add the code?

Should assesment value be "0" or "1"?

It it is "1", the assesments counts all the choices, wheter they were wrong or not.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 4 weeks ago - 5 months 4 weeks ago #251658 by Joffm
Assesment values in multiple questions are more or less useless as you can't set different values onto the subquestions.
Furthermore you do not access the assessment values in your equation.
Read the manual about "access to variables".

But as we showed no assessment values necessary.

As the shown equation is correct, have a look at the source code of this question.
Maybe there's some HTML code in the equation.
Happens sometimes if you copy the equation from somewhere.

Anyway, you should send the lss export.

Joffm

 
Each one works as expected.
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 months 4 weeks ago by Joffm.

Please Log in to join the conversation.

  • Jenska
  • Jenska's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 months 4 weeks ago #251661 by Jenska
So I have misunderstood something (badly).

If assesment values cannot be set for multiple choice questions, it is a huge shortcoming.

But now I don't know what that code should do/be suppoused to do     ---> How do I calculate the scores if I can not use assesments?
Is there a youtube-video I could watch?

-feeling stupid

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 3 weeks ago #251670 by Joffm
Assesment values work on answer options, not on subquestions which - in "multiple" questions can have only one - the same - answer : "selected".

​​​​​​
If you want to have different weights of the subquestions, like
"subquestion 1 selected" = 4 points
"subquestion 2 selected" = -1point
...

you use a simple equation where you sum, like
​​​​​{sum(if(q1_SQ001="Y",4,0),if(q1_SQ002="Y",-1,0),...)}

And we always ask for lss exports, neither lsq nor lsg.

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 3 weeks ago #251676 by Joffm
We do not know how you want to calculate the score.

E.g. let's take your xample (multiple question with six subquestions, obviously 3 are correct)
How you count the "correct" answers, you know.
But the respondent will get the same result if he selects all subquestions. So this is not really useful.

a. You could consider to add one point for each correct answer and subtract one point for each wrong answer.
b. Or you only sum points if there is no wrong answer at all.
c. Or you give 1 point, if there is 1 correct answer, 3 points, if there are 2 correct answers and 7 points, if there are all 3 correct answers.
c1. And subtract 2 points for each False answer.

For all these scenarios it would be convenient to use subquestion codes like
C01, C03, C05 for the "Correct" answers
F02, F04, F06 for the "False" answers

Then with the use of the variable "that"
[url] manual.limesurvey.org/ExpressionScript_-....22that.22_variables [/url]

a. {count(that.Q1.sq_C)-count(that.Q1.sq_F)}
b. {if(count(that.Q1.sq_F)>0,0,count(that.Q1.sq_C))}
c. {if(count(that.Q1.sq_C)==1,1,if(count(that.Q1.sq_C)==2,3,if(count(that.Q1.sq_C)==3,7,0)))}
c1. {if(count(that.Q1.sq_C)==1,1-2*count(that.Q1.sq_F),if(count(that.Q1.sq_C)==2-2*count(that.Q1.sq_F),3,if(count(that.Q1.sq_C)==3,7-2*count(that.Q1.sq_F),-6)))}

Just create a question if type "equation" and enter your desired function.

But unless we do not know what and how you want to calculate your score (and please, do not try to use "assessment rules", this is stone age and outdated since we have ExpressionManager/Script, which is much more flexible) we can't help better..

Nevertheless you may use assessment values (always usefil, if in a single punch question you would like to have negative weights or the same weight fir different answer options.
Easy to mix, as long as you use the correct access
[url] manual.limesurvey.org/ExpressionScript_-...#Access_to_variables [/url]

You access the code by {Q1[.NAOK]} and the assessment value by {Q1.value[NAOK]}   [] = optional

Read the manual about ExpressionScript, download and study the sample surveys
[url] manual.limesurvey.org/ExpressionScript_sample_surveys [/url]
to get familiar with the functions and their syntax.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose