- Posts: 4
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
4 years 11 months ago #184844
by bpbpbp
Create a Final Survey Question: Sum of all Array values was created 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..
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11655
- Thank you received: 2742
4 years 11 months ago #184848
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 Create a Final Survey Question: Sum of all Array values
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:
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:
So to get a sum of all responses to Q1 you would do something like:
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13642
- Thank you received: 2491
4 years 11 months ago #184850
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.
Replied by DenisChenu on topic Create a Final Survey Question: Sum of all Array values
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 …
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
4 years 10 months ago #184933
by bpbpbp
Replied by bpbpbp on topic Create a Final Survey Question: Sum of all Array values
Thank you I will give it a try!
The topic has been locked.
- bpbpbp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
4 years 10 months ago #184934
by bpbpbp
Replied by bpbpbp on topic Create a Final Survey Question: Sum of all Array values
Thanks for your suggestion, however as a newbie I don't understand your instructions at all, sorry!
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13642
- Thank you received: 2491
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.
Replied by DenisChenu on topic Create a Final Survey Question: Sum of all Array values
Sorry,
My advice is here : www.sondages.pro/documentation-limesurve...ire-expressions.html and here www.sondages.pro/documentation-limesurve...sion-limesurvey.html
But … only in french …
My advice is here : www.sondages.pro/documentation-limesurve...ire-expressions.html and here www.sondages.pro/documentation-limesurve...sion-limesurvey.html
But … only in french …
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.
- cdorin
- Offline
- Elite Member
Less
More
- Posts: 234
- Thank you received: 40
4 years 10 months ago #184972
by cdorin
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.
Replied by cdorin on topic Create a Final Survey Question: Sum of all Array values
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.