- Posts: 21
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Equation with ASSESSMENT_CURRENT_TOTAL not working
- Drewskie
- Topic Author
- Offline
- Junior Member
Less
More
7 years 8 months ago #138640
by Drewskie
Equation with ASSESSMENT_CURRENT_TOTAL not working was created by Drewskie
Good day,
I have a survey with 5 question groups
Each group has a List(radio) question
Based on the answer it it show the second question
I have enabled assessment on the survey and assigned values to the radio selections
Now my problem:
I want to record the value in the database for each question group.
I used a equation question at the end of each question group that displays ASSESSMENT_CURRENT_TOTAL
The problem is that this value increases based on the previous question groups.
I need to get a total just for the current question group only
I tried {ASSESSMENT_CURRENT_TOTAL}-{Tot1.value} but that just shows 3 - 2 in the database instead of 1
Any help will be appreciated.
I have a survey with 5 question groups
Each group has a List(radio) question
Based on the answer it it show the second question
I have enabled assessment on the survey and assigned values to the radio selections
Now my problem:
I want to record the value in the database for each question group.
I used a equation question at the end of each question group that displays ASSESSMENT_CURRENT_TOTAL
The problem is that this value increases based on the previous question groups.
I need to get a total just for the current question group only
I tried {ASSESSMENT_CURRENT_TOTAL}-{Tot1.value} but that just shows 3 - 2 in the database instead of 1
Any help will be appreciated.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10612
- Thank you received: 3691
7 years 8 months ago #138644
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Equation with ASSESSMENT_CURRENT_TOTAL not working
The easiest way would be to assign the answer codes as the "score" instead of using assessments. Then your equation would simply be something like:
Or, if there are multiple questions on a page:
Code:
{q1.NAOK}
Or, if there are multiple questions on a page:
Code:
{sum(q1.NAOK, q2.NAOK, q3.NAOK)}
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Drewskie
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 1
7 years 8 months ago #138645
by Drewskie
Replied by Drewskie on topic Equation with ASSESSMENT_CURRENT_TOTAL not working
Thanks but this brings in a new issue as I have two answers that get 0 score.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10612
- Thank you received: 3691
7 years 8 months ago #138648
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Equation with ASSESSMENT_CURRENT_TOTAL not working
Then you'll need to use IF statements (line-breaks inserted for clarity):
Code:
{if(q1==1, 0, if(q1==2, 0, if(q1==3, 1, if(q1==4, 2, '' ))))}
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Drewskie
The topic has been locked.
- Drewskie
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 1
7 years 8 months ago #138663
by Drewskie
Replied by Drewskie on topic Equation with ASSESSMENT_CURRENT_TOTAL not working
That worked perfectly, thank you.
Just a quick sanity check, to get the sum of all these I would use the following formula?
{sum(Tot1.value, Tot2.value, Tot3.value)}
(Tot1 etc is my if question code)
Just a quick sanity check, to get the sum of all these I would use the following formula?
{sum(Tot1.value, Tot2.value, Tot3.value)}
(Tot1 etc is my if question code)
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13912
- Thank you received: 2549
7 years 8 months ago #138667
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 Equation with ASSESSMENT_CURRENT_TOTAL not working
Yes the {sum(Tot1.value, Tot2.value, Tot3.value)} do the trick.
For the 1st issue : can you send a little survey file ? I'm unsure it must do something like this : if your survey is group by groiup and you add an assesment equation : each assesment equation must be different ( 1st is for 1st group, 2nd for 2nd group + 1st group etc ..., EXCEPT is user move previous ....)
For the 1st issue : can you send a little survey file ? I'm unsure it must do something like this : if your survey is group by groiup and you add an assesment equation : each assesment equation must be different ( 1st is for 1st group, 2nd for 2nd group + 1st group etc ..., EXCEPT is user move previous ....)
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.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10612
- Thank you received: 3691
7 years 8 months ago #138672
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Equation with ASSESSMENT_CURRENT_TOTAL not working
@Denis, the original post said "I need to get a total just for the current question group only.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13912
- Thank you received: 2549
7 years 8 months ago - 7 years 8 months ago #138675
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 Equation with ASSESSMENT_CURRENT_TOTAL not working
Yes, i know, but after is just a question of Math :
AssessGroup1: {assessment_CURRENT_TOTAL}
AssessGroup2: {assessment_CURRENT_TOTAL-AssessGroup1}
AssessGroup3: {assessment_CURRENT_TOTAL-AssessGroup1-AssessGroup2}
BUT : there are issue if user move previous back / move next
AssessGroup1: {assessment_CURRENT_TOTAL}
AssessGroup2: {assessment_CURRENT_TOTAL-AssessGroup1}
AssessGroup3: {assessment_CURRENT_TOTAL-AssessGroup1-AssessGroup2}
BUT : there are issue if user move previous back / move next
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.
Last edit: 7 years 8 months ago by DenisChenu. Reason: Math
The topic has been locked.