- Posts: 17
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
7 years 8 months ago #138707
by Moonlight7
Total sum of scores from three equation questions in a group was created 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
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11758
- Thank you received: 2753
7 years 8 months ago #138711
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Total sum of scores from three equation questions in a group
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 0
7 years 8 months ago #138712
by Moonlight7
Replied by Moonlight7 on topic Total sum of scores from three equation questions in a group
Here is a shortened sample attached.
Thanks so much
Thanks so much
Attachments:
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11758
- Thank you received: 2753
7 years 8 months ago - 7 years 8 months ago #138716
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Total sum of scores from three equation questions in a group
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.
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.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Attachments:
Last edit: 7 years 8 months ago by holch.
The following user(s) said Thank You: Moonlight7
The topic has been locked.
- Moonlight7
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 0
7 years 8 months ago #138717
by Moonlight7
Replied by Moonlight7 on topic Total sum of scores from three equation questions in a group
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
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.