Welcome to the LimeSurvey Community Forum

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

Issue with scoring different groups

  • kimnese
  • kimnese's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #201694 by kimnese
Issue with scoring different groups was created by kimnese
Hi dear Limesurvey community,
I am still relatively inexperienced in Limesurvey and I want create a survey with different groups and their perspective scoring.

I added 3 answer options (Know well, Knoll little, no idea) and each answer has a different value of points, depending on the question group.

I have tried to the sum function sum

Calculate the sum of values in an array number sum(arg1, arg2, ... argN)

But the result is 0.

Since that did not work I have tried several formulas that I have picked up in the forum, none of them seem to properly.
Can you please advise?
Thank you and kind regards, Kim
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #201703 by Joffm
Replied by Joffm on topic Issue with scoring different groups
Hi,

there are a few misunderstandings from your side.
You have single punch questions like A11
Code, Assessment Value , Answer text
A001, 20, Know well
A002, 10, Know little
A003, 0, No idea


Now you tried the following formulas:

1.
{sum(if(A11!=20,10,0),if(A12!=20,10,0),if(A13!=20,10,0),if(A14!=20,10,0),if(A15!=20,10,0))}
Did you understand what this IF-statement means?
It says "IF A11 is not equal to 20, then it is 10, otherwise it is 0"

Here the mistake is:
You coded A11 with alphanumerical codes "AO01",...
And these should be used in this IF-statement.
Now you compare A11 with a number, but the answer codes are "AO01", "AO02",...
So to do it like this you had to compare each
{sum(if(A11=="AO01",20,if(A11=="AO02",10,0)),if(A12=="AO01",20,if(A12=="AO02",10,0)),...}
Meaning: "IF A11 is equal to AO01, sum 20, otherwise IF A11 is equal to AO02, sum 10, otherwise sum 0"
Not the best way.

But you used assessment values. So as you find in the manual:
manual.limesurvey.org/ExpressionScript_-...#Access_to_variables
QCode.value / QCode.valueNAOK contains the selected assessment value.

So your sum is just
{sum(A11.valueNAOK,A12.valueNAOK,A13.valueNAOK,A14.valueNAOK,A15.valueNAOK)}

That's all.

Nothing else to say to the other tries.
Always you try to sum text, or to convert text.

{sum(intval(A11),intval(A12),intval(A13),intval(A14),intval(A14))}
As A11, ... is not numeric, remember your answer codes are alphanumerical "AO01". So the intval will fail obviously

{sum((A11),(A12),(A13),(A14),(A15))}

{sum(A11,A12,A13,A14,A15)}

{sum(A11.NAOK,A12.NAOK,A13.NAOK,A14.NAOK,A15.NAOK)}

As A11, ... is not numeric, you cannot sum up text, it is like sum("apple", "cherry").

Joffm

P.S.
In my opinion you never should use the default alphanumerical codes in single punch questions. These are the codes you use in your analysis.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: kimnese
The topic has been locked.
  • kimnese
  • kimnese's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #201787 by kimnese
Replied by kimnese on topic Issue with scoring different groups
Hi Joffm,
Thank you so much for your explanation and great help!

Kind regards,
Kim
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose