- Posts: 4
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
equation
- VANBEERS
- Topic Author
- Offline
- New Member
Less
More
3 years 11 months ago #199512
by VANBEERS
equation was created by VANBEERS
Hello,
Beginner, I hope to ask my question in the right place.
I carried out a first drowsiness questionnaire (Epworth) proposed for each of the 8 questions (EPW) 4 proposals (with assignment value) in the form of a radio list. As a result of the handover, I simply want a sum of the assignment values.
I created a last question (Q09) with an equation type response to perform this calculation. I inserted in the field "question" the formula:
{sum (that.EPW01.NAOK, that.EPW02.NAOK, that.EPW03.NAOK, that.EPW04.NAOK, that.EPW05.NAOK, that.EPW06.NAOK, that.EPW07.NAOK, that.EPW08.NAOK )}
to present the score to the respondent.
Whatever the answers, the sum is always zero.
Could you tell me about the mistakes made?
Thank you.
Beginner, I hope to ask my question in the right place.
I carried out a first drowsiness questionnaire (Epworth) proposed for each of the 8 questions (EPW) 4 proposals (with assignment value) in the form of a radio list. As a result of the handover, I simply want a sum of the assignment values.
I created a last question (Q09) with an equation type response to perform this calculation. I inserted in the field "question" the formula:
{sum (that.EPW01.NAOK, that.EPW02.NAOK, that.EPW03.NAOK, that.EPW04.NAOK, that.EPW05.NAOK, that.EPW06.NAOK, that.EPW07.NAOK, that.EPW08.NAOK )}
to present the score to the respondent.
Whatever the answers, the sum is always zero.
Could you tell me about the mistakes made?
Thank you.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12937
- Thank you received: 3979
3 years 11 months ago #199515
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic equation
Hi,
There are several mistakes:
1. As EPW are list radio questions, do dont have to use "that".
"self" or "that" are used for quesions with subquestions, rows, columns.
Manual:
Let's take an array(numbers) with subquestions (Y001,Y002) and columns (X001,X002,X003)
So "sum(that.Q1)" would be extended to "sum(Q1_Y001_X001,Q1_Y001_X002,Q1_Y001_X003,Q1_Y002_X001,Q1_Y002_X002,Q1_Y002_X003)"
In your case you have a single punch question, So you just use ...?
Yes, what do you use?
As the manual says here:
manual.limesurvey.org/ExpressionScript_-...#Access_to_variables
{EPW01} - the code of the question - an alias for {EPW01.code}
and
{EPW01.code} - the selected response code for the question
2. And here your second mistake.
You do not want to sum up the selected code, but the assessment value.
Again in the manual
{EPW01.value} - the assessment value for the question
So finally your equation is
{sum (EPW01.valueNAOK, EPW02.valueNAOK, EPW03.valueNAOK, EPW04.valueNAOK, EPW05.valueNAOK, EPW06.valueNAOK, EPW07.valueNAOK, EPW08.valueNAOK )}
3. And your third one
Joffm
There are several mistakes:
1. As EPW are list radio questions, do dont have to use "that".
"self" or "that" are used for quesions with subquestions, rows, columns.
Manual:
Quite often you want to evaluate all the parts of a question, such as counting how many subquestions have been answered or summing up the scores. Other times you want to process just certain rows or columns of a question (such as getting the row or column sums and storing them in the database). These reserved variables make that process relatively painless.
Let's take an array(numbers) with subquestions (Y001,Y002) and columns (X001,X002,X003)
So "sum(that.Q1)" would be extended to "sum(Q1_Y001_X001,Q1_Y001_X002,Q1_Y001_X003,Q1_Y002_X001,Q1_Y002_X002,Q1_Y002_X003)"
In your case you have a single punch question, So you just use ...?
Yes, what do you use?
As the manual says here:
manual.limesurvey.org/ExpressionScript_-...#Access_to_variables
{EPW01} - the code of the question - an alias for {EPW01.code}
and
{EPW01.code} - the selected response code for the question
2. And here your second mistake.
You do not want to sum up the selected code, but the assessment value.
Again in the manual
{EPW01.value} - the assessment value for the question
So finally your equation is
{sum (EPW01.valueNAOK, EPW02.valueNAOK, EPW03.valueNAOK, EPW04.valueNAOK, EPW05.valueNAOK, EPW06.valueNAOK, EPW07.valueNAOK, EPW08.valueNAOK )}
3. And your third one
This is obviusly not a "Installation & Update" issue.I hope to ask my question in the right place
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
3 years 11 months ago #199519
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
I move it
Design issues
Please report here if you have questions or problems how to setup your survey.
Design issues
Please report here if you have questions or problems how to setup your survey.
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.
- VANBEERS
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
3 years 10 months ago #200127
by VANBEERS
Replied by VANBEERS on topic equation
Thanks Joffm,
The answers and advice were very helpful to me. No mistake. Also, I was able to carry out very varied questionnaires, carry out tests and validation; which explains my late thanks.
Pascal
The answers and advice were very helpful to me. No mistake. Also, I was able to carry out very varied questionnaires, carry out tests and validation; which explains my late thanks.
Pascal
The topic has been locked.