- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Problem with calculation; and using results of that calculation for max value
- scroon
- Topic Author
- Offline
- New Member
Less
More
7 years 10 months ago #136725
by scroon
Problem with calculation; and using results of that calculation for max value was created by scroon
Hi there
I have tried to hunt for an answer and I'm still stuck, so thought I'd ask.
1. I have a survey where we have two numerical questions (e.g. how many males have you had sex with). These are BW01 and BW01a.
2. Then we have created a new, hidden variable (type: equation), where we have tried to create a value that is the sum of those two numerical questions. The formula we are using for this is =sum(BW01,BW01a)
3. For a later question, we want to do data checking by ensuring that the maximum value allowed for a subsequent numerical input question is equal to the result of that formula question
but it doesn't work!
I know that the error could be in one or both of those steps but I can't find out where to test if the formula in step 2 is correct/incorrect or if it is in the subsequent step!
So, any advice would be *greatly* appreciated!!
I have tried to hunt for an answer and I'm still stuck, so thought I'd ask.
1. I have a survey where we have two numerical questions (e.g. how many males have you had sex with). These are BW01 and BW01a.
2. Then we have created a new, hidden variable (type: equation), where we have tried to create a value that is the sum of those two numerical questions. The formula we are using for this is =sum(BW01,BW01a)
3. For a later question, we want to do data checking by ensuring that the maximum value allowed for a subsequent numerical input question is equal to the result of that formula question
but it doesn't work!
I know that the error could be in one or both of those steps but I can't find out where to test if the formula in step 2 is correct/incorrect or if it is in the subsequent step!
So, any advice would be *greatly* appreciated!!
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
7 years 10 months ago #136736
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 Problem with calculation; and using results of that calculation for max value
For testing purposes, leave your equation question(s) visible so you can see the generated results.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11655
- Thank you received: 2740
7 years 10 months ago #136759
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 Problem with calculation; and using results of that calculation for max value
are you using the equal character "=" in your equation?
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: tpartner
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
7 years 10 months ago #136763
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 Problem with calculation; and using results of that calculation for max value
Yeah, good catch holch. You do not need the equals operator to return the value of that sum. Simply:
Code:
sum(BW01, BW01a)
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.