Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Condition from result of an equation

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #199707 by holch
Replied by holch on topic Condition from result of an equation
OK, so there seem to be other problems. I thought this might be it.

Then some more testing will be required. Had hoped that the solution was that easy. ;-)

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.
  • arnaudbore
  • arnaudbore's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #199708 by arnaudbore
Replied by arnaudbore on topic Condition from result of an equation
That's why I added the question test into my survey to be able to see/debug the question G3Q0012... but so far it didn't help.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #199709 by Joffm
Replied by Joffm on topic Condition from result of an equation
And you could shorten your relevance equation to
(age>11 and age<50) or (QMenopauseYear.NAOK=="N" or QMenopause.NAOK=="N")

In my opinion - tested several times - this works fine.

Joffm

By the way: your age calculation fails if I was born in 1901.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • arnaudbore
  • arnaudbore's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #199711 by arnaudbore
Replied by arnaudbore on topic Condition from result of an equation
It works ! Thank you,
My relevance equation was not perfect but I still don't understand why it was not working.

Anyway, thank you very much !
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #199712 by holch
Replied by holch on topic Condition from result of an equation

By the way: your age calculation fails if I was born in 1901.

I knew you were a pensioner, but I didn't expect that... ;-)

How high are the chances that someone born in 1901 is still alive, using this online questionnaire and requiring and MRI? I think one can risk it not to work from 1901 downwards. Hahahaha.

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.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago - 3 years 11 months ago #199714 by Joffm
Replied by Joffm on topic Condition from result of an equation
No, I was thinking about setting a realistic minimum year.

You can set this by
"minimum date": "-75 years"
"maximum date": "now"

Now the drop down starts at 1900 and while testing I clicked something there.
But it's an interesting fact that I will investigate.
In that case the difference (time - mktime) exceeds the size of an integer (4294967295)

But I have the idea why the equation failed.
Here
(age>11 and age<50) or (age>49 and (QMenopause=="Y" and QMenopauseYear=="N")) or (age>49 and QMenopause=="N")
QMenopauseYear is not defined, if
QMenopause=="N"
age<50

So the whole equation will not work.
Therefore there is the NAOK.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 11 months ago by Joffm.
The topic has been locked.
  • arnaudbore
  • arnaudbore's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #199757 by arnaudbore
Replied by arnaudbore on topic Condition from result of an equation
Thank to all of you for the precious help !!
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #199860 by Joffm
Replied by Joffm on topic Condition from result of an equation
Instead of:
{round(floor((time() - mktime(0,0,0,substr(G3dateOfBirth,5,2),substr(G3dateOfBirth,8,2),substr(G3dateOfBirth,0,4)))/(24*60*60))/365,0)}

this is better:
{floor(((strtotime(date("Y-m-d"))-strtotime(G3dateOfBirth))/86400)/365)}

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose