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
  • scroon's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 10 months ago #136725 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!!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 10 months ago #136736 by tpartner
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
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 10 months ago #136759 by holch
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
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 10 months ago #136763 by tpartner
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.

Lime-years ahead

Online-surveys for every purse and purpose