- Posts: 11660
- Thank you received: 2742
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Condition from result of an equation
- holch
- Offline
- LimeSurvey Community Team
Less
More
3 years 11 months ago #199707
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 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.
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
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 43
- Thank you received: 1
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12935
- Thank you received: 3979
3 years 11 months ago #199709
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
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.
(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
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 43
- Thank you received: 1
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 !
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11660
- Thank you received: 2742
3 years 11 months ago #199712
by holch
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.
Replied by holch on topic Condition from result of an equation
I knew you were a pensioner, but I didn't expect that...By the way: your age calculation fails if I was born in 1901.
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12935
- Thank you received: 3979
3 years 11 months ago - 3 years 11 months ago #199714
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
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
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
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 43
- Thank you received: 1
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12935
- Thank you received: 3979
3 years 11 months ago #199860
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
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
{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.