Welcome to the LimeSurvey Community Forum

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

Create a Final Survey Question: Sum of all Array values

  • bpbpbp
  • bpbpbp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 10 months ago #184844 by bpbpbp
Hi!

This is my first post and my first trial survey creation.

I have 1 survey, 1 question group with 7 questions.

Question #1, #3 and #5 are all Array(5) questions, storing values 1 to 5 I presume, each with 4 sub-questions.

I create a final question (#7) as an Equation, and I want to know the correct code to sum all sub-questions of #1, #3 and #5.

I don't know where to begin, and the documentation is very detailed but overwhelming..
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 10 months ago #184848 by holch
You will not manage to work with equations without reading about EM within the manual. But I can understand that it is overwhelming. To find out on how to address a certain question/subquestion/answer, it helps to look at the question logic files, because it shows you, how this is addressed.

Now here an example for array questions. You have two factors here that you need to take in to account: subquestions and answer options.

As you want to know the value of the answer option, you to read this into your equation, which can be done by something like this:
Code:
{questioncode_subquestioncode}

So let's assume your first question has the question code "Q1" and the subquestions are called SQ1, SQ2, SQ3 and SQ4.

So you'll get the answer code subquestion 1 like this:
Code:
{Q1_SQ1}

So to get a sum of all responses to Q1 you would do something like:
Code:
{sum(Q1_SQ1, Q1_SQ2, Q1_SQ3, Q1_SQ4)}

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.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 10 months ago #184850 by DenisChenu
Personnaly my advice for equatiuon is

1. use gui editor equation to know Question Variables
2. Start with simple part : == != ge …
3. Add count an sum
4. After : get a bookmark to EM available function …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • bpbpbp
  • bpbpbp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 10 months ago #184933 by bpbpbp
Thank you I will give it a try!
The topic has been locked.
  • bpbpbp
  • bpbpbp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 10 months ago #184934 by bpbpbp
Thanks for your suggestion, however as a newbie I don't understand your instructions at all, sorry!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 10 months ago #184939 by DenisChenu

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
4 years 10 months ago #184972 by cdorin
You need to use expressions which is a powerful feature of LS. For more details, please check this wiki section: manual.limesurvey.org/Expression_Manager_-_presentation . For examples, see: manual.limesurvey.org/Expression_Manager_sample_surveys

Manual: manual.limesurvey.org/LimeSurvey_Manual
Bugs tracker: bugs.limesurvey.org/my_view_page.php
If you self-host and need help, contact one of our partners: limesurvey.com
Please do not contact me via PM - thank you.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose