# Generating "Score" From 100+ Question Survey

5 years 8 months ago #73704
FreedomTrip created the topic: Generating "Score" From 100+ Question Survey
I am building a 50 question test using LimeSurvey, containing 10 different categories (5 questions each). Each question has 3 possible answers, including the "other" option.

Here's my issue: I am trying to figure out how I can take each answer and give it a "score" that will add up to a final test "score" that users can see. This final score will be a number between 1 and 100. Users start the test with a base score of 50. Some choices will give a (+1), some will give a (-1), and then I have the "other" option which will give a (0). The final score is determined by the adding and subtracting of these point values.

Any easy way to do this sort of logic?

5 years 8 months ago - 5 years 8 months ago #73708 by TMSWhite
TMSWhite replied the topic: Generating "Score" From 100+ Question Survey
See the documentation for Expression Manager and the HowTo examples.

Although you could create a single expression that has all 100 variables, I'd recommend breaking it up. So, since you have 10 categories, you could create a hidden Equation question for each category to create the category-specific score. Say your variables names are named by category (A-J) and question within category (1-3) - so A1-A3, B1-B3, ... J1-J3. Then, scale-scores would be like this (where let's call the category score Xscore where X is the category.). So Ascore would be:
`sum(A1.NAOK,A2.NAOK,A3.NAOK)`

Then, the total score would be the sum of each of the category scores (plus your starting score of 50).
`sum(50,Ascore.NAOK,Bscore.NAOK,...,Jscore.NAOK)`

For your reports, you could show the final score (let's call it finalScore) as
`Thanks for filling out our survey, {TOKEN:FIRSTNAME}.  Your final score was {finalScore}.`

Incidentally, the reason for all the NAOK is in case you have conditions on your questions - the NAOK would let you compute the scores anyway. If conditions hid any of the parts of the sum and you didn't use .NAOK, then {finalScore} would always = 0.
Last Edit: 5 years 8 months ago by TMSWhite.

5 years 8 months ago #73714 by tpartner
tpartner replied the topic: Generating "Score" From 100+ Question Survey
If using 1.91+ or earlier, you will need to use a little JavaScript to calculate the score. Details of the script would depend on the survey structure how many questions per page, etc.).

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

5 years 8 months ago #73752 by Mazi
Mazi replied the topic: Generating "Score" From 100+ Question Survey
At Limesurvey the according scoring feature is called "assessment", see docs.limesurvey.org/Assessments&structur...tions+for+LimeSurvey

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

5 years 8 months ago #73789
FreedomTrip replied the topic: Generating "Score" From 100+ Question Survey
Thanks for the replies, guys.
I'm upgrading to 1.92 right now so I can take advantage of the Expression Manager. I'm excited to see how that will work. I'll keep you updated.

5 years 8 months ago #73796
FreedomTrip replied the topic: Generating "Score" From 100+ Question Survey
Hey TMSWhite- could you possibly elaborate on the steps here? I've never used the EM, and am honestly still figuring out LimeSurvey. Would I put these expressions in questions set to not display? Where do I define, as in your example, "Ascore", etc.? I have all my cats/structure configured the way I want it...I just need to figure out how to apply this code to my categories and questions.

5 years 8 months ago #73873
FreedomTrip replied the topic: Generating "Score" From 100+ Question Survey
Okay, more succinctly, where do I define the value of each answer choice? I.e. If a user answers A for one question, that would add a (+1) and if they chose B, it would add a (-1), and if they chose no answer it would add a (0)?

5 years 8 months ago #73881 by Mazi
Mazi replied the topic: Generating "Score" From 100+ Question Survey
Better use positive numbers only and afterwards do a X=SUM(a+b+c)-50.

Have a look at the assessment feature (not sure if EM accesses the assessment scores) and also set up according answer codes.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

5 years 8 months ago #74073
FreedomTrip replied the topic: Generating "Score" From 100+ Question Survey
Alright...trying to figure out why this isn't working for me. I have Assessments enabled, and have given all answer choices the correct score (+1, -1, or 0). I have added hidden Equation questions at the end of each Question Group, summing up the scores from the questions. I have a separate group and a hidden question at the end of the quiz, summing up all Group total variables and adding them to 50.
First thing - the final score returned is always 50. The equations seem to be not giving weight to the individual questions...

Second thing - I named the final sum question "finalScore". Calling this in the results page (i.e. Your final score is {finalScore}.) does not return anything. It's blank.

Any insights?

5 years 8 months ago #74074 by TMSWhite
TMSWhite replied the topic: Generating "Score" From 100+ Question Survey
If you attach the survey, I can take a look. If the content is proprietary, send me a private message and I can give you contact information to email me a copy.

5 years 8 months ago - 5 years 8 months ago #74077 by TMSWhite
TMSWhite replied the topic: Generating "Score" From 100+ Question Survey
FreedomTrip-

You were very close. Your equations like:
`sum(PF1.NAOK, PF2Abortion.NAOK)`

should have been this, since you want the assessment value (not the A-C sub-question codes):
`sum(PF1.valueNAOK, PF2valueNAOK)`

When I make those changes, and un-hide the Equation questions (and switch to all-in-one mode), I see the values of the sums change dynamically as I'd expect. Except for finalScore.

Turns out, there are two issues that keep it from working properly:
(1) The process I used to extract the equation value and populate the database works fine for the default template. However, it does not work for the basic template. I'll open a bug report on that.

(2) The final equation isn't being processed due to a different bug, which I'll also report.

/Tom
Last Edit: 5 years 8 months ago by TMSWhite.

5 years 8 months ago #74082 by Mazi
Mazi replied the topic: Generating "Score" From 100+ Question Survey

TMSWhite wrote: Turns out, there are two issues that keep it from working properly:
(1) The process I used to extract the equation value and populate the database works fine for the default template. However, it does not work for the basic template. I'll open a bug report on that.

Tom, is there a ticket for this?
If not, can you outline the problem in more detail? Because we have to be sure that EM works for all (also customized) templates. It should not depend on any elements of the templates, because e. g. some use a table based layout while others use DIVs.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

5 years 8 months ago #74098
DenisChenu replied the topic: Generating "Score" From 100+ Question Survey

Mazi wrote:

TMSWhite wrote: Because we have to be sure that EM works for all (also customized) templates.

?

Are you sure ?
We already have some issue after put question.pstpl template ({QUESTION_SESSTIAL}).

1.92 are a major version, maybe there can be some customized template incompatibility ?

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

5 years 8 months ago #74120 by TMSWhite
TMSWhite replied the topic: Generating "Score" From 100+ Question Survey
Mazi-

I opened two bugs which I hope to tackle today:
(1) bugs.limesurvey.org/view.php?id=5804 - I plan to add something like an .em_equation class to {QUESTION_TEXT} so that I can more easily extract the value. That should ensure that it will work across templates.

(2) bugs.limesurvey.org/view.php?id=5803 - this is not a problem in 1.92 RC3 but relates to some optimizations I recently did. Also easy to fix.

/Tom

5 years 8 months ago #74121 by Mazi
Mazi replied the topic: Generating "Score" From 100+ Question Survey

Shnoulle wrote: 1.92 are a major version, maybe there can be some customized template incompatibility ?

I don't agree. I would say that ~70-80% of our users use a customized template or slightly edited shipped template. We have to focus on compatibility here.

For Limesurvey 2.0 one could say "this is a major release with a completely rewritten code base, customized templates have to be adjusted", though we should try to work around that.

Best regards/Beste Grüße,
Dr. Marcel Minke