Jump to content
Sign in to follow this  
BMS3122

Calculation for a person's age !

Recommended Posts

Can anyone provide an age calculation code for an FMP novice??? The way my mind works, I would use four(4)number fields: BirthYear, CurrentYear, BirthMonth and CurrentMonth. Find the DIFFERENCE between the related fields and voila... # of years & # months !!! Just as people say, "I'm 29 years and 6 months." Well, I've tried all the permutations using my 4 fields but...

Question 1: Is there a possible calculation code that would follow my mind's reasoning path : (Using the 4 fields)

Question 2. How would FMP do this calculation :

Specifically.. what fields do I need to create, what operators, and how do I write the formula for FMP's calculation editor ;)

I love FMP but I'm obviously in the twilight zone when it comes to calculations (although I've proudly done several S I M P L E ones!)

This is important to me and your help would be a godsend.

Share this post


Link to post
Share on other sites

Start with this Thread. Link

Share this post


Link to post
Share on other sites

Try this

" Year " & (Year(Status(CurrentDate)) - Year(DOB) - If(Status(CurrentDate) < Date(Month(DOB); Day(DOB); Year(Status(CurrentDate))); 1; 0)) &"," &

" Month " & (Mod(Month(Status(CurrentDate)) - Month(DOB) + 12 - If(Day(Status(CurrentDate)) < Day(DOJ); 1; 0); 12)) &"," &

" Day " &

(Today- Date(Month(Status(CurrentDate)) - (Day(DOB) > Day(Status(CurrentDate))); Day(DOB); Year(Today)))

Share this post


Link to post
Share on other sites

The Status ( ) functions aren't more alive.

They were substituted by the Get ( ) functions.

ALSO

the Today function was substituted by the Get ( CurrentDate ) function.

Note that there is even a typing error ( DOJ instead of DOB ) and that the "If" can be substituded by boolean evaluations.

So, for years and months, you can try this UNSTORED calculation:

Let([

today = Get ( CurrentDate ) ;

Y = Year ( today ) ;

M = Month ( today ) ;

D = Day ( today ) ;

yDOB = Year ( DOB ) ;

mDOB = Month ( DOB ) ;

dDOB = Day ( DOB )

];

Y - yDOB - ( today < Date ( mDOB ; dDOB ; Y ) ) & " years and " & Mod ( M - mDOB + 12 - ( D < dDOB ) ; 12 ) & " months"

)

Share this post


Link to post
Share on other sites

Thanks for your correction, I try that using old version of filemaker ver 6

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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