Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4113 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have the "date_of_birth" field and the "date_of_death" field

 

I would like to calculate the current age, which is easy if the person is alive by using the Get CurrentDate function; however, if the person is dead, how should the value "date_of_death" field be used in the calculation to replace the CurrentDate value

 

Thanks.

Posted

Try =

Let (
date_of_calc = Case ( date_of_death ; date_of_death ; Get ( CurrentDate ) )
;
Year ( date_of_calc ) - Year ( date_of_birth ) - ( date_of_calc < Date ( Month ( date_of_birth ) ; Day ( date_of_birth ) ; Year ( date_of_calc ) ) )
)

Calculation must be unstored for the benefit of people still alive.

  • Like 1
Posted

Thanks again Mr. Comment;

 

The calculation works great.

 

Just need an additional feature which is to calculate the age in months and days if age is <1 year, years and months if age <6 years.

Posted

Ahmm... is this for medical purposes? If yes, I'd suggest calculating the month as equal to approximately 30 days and the year as equal to 365 days or so - rather than taking into account when exactly does the birthday fall in the current year/month. It makes the calculation simpler and more logical - otherwise you may find two people with exactly the same age in days having different ages when expressed in months and days.

  • Like 1
Posted
Yes indeed, it is for medical purposes and I appreciate your suggestion.
 
What if I have the same output format for all ages as follows : ##Y ##M ##D
 
Is it logical ?
 
If you agree, how can I do that?
 
THANKS
Posted
What if I have the same output format for all ages as follows : ##Y ##M ##D

 

It makes very little difference: you can have one format for all =

Let ( [
date_of_calc = Case ( date_of_death ; date_of_death ; Get ( CurrentDate ) ) ;
n = date_of_calc- date_of_birth + 1;
y = Div ( n ; 365.2425 ) ;
r = Mod ( n ; 365.2425 ) ;
m = Div ( r ; 30.436875 ) ;
d = Round ( Mod ( r ; 30.436875 ) ; 0 )
] ;
y & "Y " & m & "M " & d & "D"
)

or different formats for each group, as you asked before =

Let ( [
date_of_calc = Case ( date_of_death ; date_of_death ; Get ( CurrentDate ) ) ;
n = date_of_calc- date_of_birth + 1;
y = Div ( n ; 365.2425 ) ;
r = Mod ( n ; 365.2425 ) ;
m = Div ( r ; 30.436875 ) ;
d = Round ( Mod ( r ; 30.436875 ) ; 0 )
] ;
Case (
y < 1 ; m & "M " & d & "D" ;
y < 6 ; y & "Y " & m & "M" ;
y & "Y" )
)

The important part to remember is that that these are average months and years; so a patient may disagree with you when you state their age as 30, when their 30th birthday is still a few days away...

Posted

In fact, we encounter this age problem with patients every now and then; however, I can not be thankful enough for your great help..

 

These two formulas are great...

 

 

THANXXXXXXXX

This topic is 4113 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.