Welcome to the LimeSurvey Community Forum

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

Total sum of scores from three equation questions in a group

  • Moonlight7
  • Moonlight7's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago #138707 by Moonlight7
Hi everyone,
I am new to LS and still trying to find my way around. This seems very challenging sometimes though!

I have three different questions (an MCQ, and two Array questions) in a group. I set an equation type question after each of the three questions to display the total score for each question.

I now need to get the total of all the three scores so I created a fourth equation question and did this :

{sum(q1Score, q2Score, q3Score)} but this gives nothing and keeps 0 all time

I then tried this:
{sum(!is_empty(q1Score), !is_empty(q2Score), !is_empty(q3Score))} but this gives the number 3 all times regardless of the three scores.

and finally tried this and got same as above:
{sum((q1Score), (q2Score), (q3Score))}

All the questions are on one page and my logic file is clean of any errors. No red highlights anywhere in my codes.

I searched the forums and manual for any info or examples to no luck !

I highly appreciate any help or hints to put me on the right way.

Thanks so much
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago #138711 by holch
LSS file?

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • Moonlight7
  • Moonlight7's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago #138712 by Moonlight7
Here is a shortened sample attached.

Thanks so much

File Attachment:

File Name: limesurvey...ions.lss
File Size:34 KB
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago - 7 years 8 months ago #138716 by holch
I am not too overly surprised that you don't get any sums that make sense.

You are currently trying to sum up 3 strings and this of course won't work.

In your equation question you store "Q1 Score: →" in front of your value, which makes the whole thing a string and not a number.

I took out all the HTML and text and left only the sums that you calculate and this gives the correct values for scenario 1 and 3. Scenario 2 doesn't sum the values, but counts the questions that are not empty.

I'll upload the corrected question group here, just import it into your survey and you'll see the difference.

File Attachment:

File Name: limesurvey..._683.lsq
File Size:2 KB

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 7 years 8 months ago by holch.
The following user(s) said Thank You: Moonlight7
The topic has been locked.
  • Moonlight7
  • Moonlight7's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago #138717 by Moonlight7
Fixed. I knew it must be something stupid I did.
Thanks holch, you taught me something that never occurred to me. Unfortunately like I'd said I'm learning only by trial and error in addition to whatever tips I find in the forums or elsewhere.

Many thanks
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose