Avatar of noad
noadFlag for United States of America

asked on 

From D.O.B I want to cal person age

I'm using FileMaker Pro 11,
I have a filed called D.O.B. and one call age
when I type in the persons D.O.B. I like for the age to come out on the age filed.

Can someone explain in details exactly how I can do this, please?

Thank you for your help
FileMaker Pro

Avatar of undefined
Last Comment
noad
Avatar of Will Loving
Will Loving
Flag of United States of America image

Age is a very straightforward calculation field. You can choose to the nearest whole year, or as I sometimes do, to show one decimal place, which is useful to see at a glance how close someone is to their next birthday. The basic calculation is:

Round( ( Get ( CurrentDate ) -  GetAsDate( DOB ) ) / 365.25 ; 0 )
Avatar of Will Loving
Will Loving
Flag of United States of America image

If you want to round the age to one decimal, you simply change the number to 1.

Round((Get ( CurrentDate ) -  GetAsDate ( DOB ))/365.25 ; 1 ) ;

Finally, if you wanted to have it show a decimal, but only for children under 10 - something I have a need for  - the calculation would look like this:

Case(
( Get( CurrentDate ) -  GetAsDate( DOB ) ) / 365.25 < 10 ;
Round( ( Get ( CurrentDate ) -  GetAsDate ( DOB ) ) / 365.25 ; 1 ) ;
Round( ( Get ( CurrentDate ) -  GetAsDate ( DOB ) ) / 365.25 ; 0 )
)
Avatar of noad
noad
Flag of United States of America image

ASKER

Willmcn


how do I enter the cal

If I understand correct, I'm just using this call "Round((Get ( CurrentDate ) -  GetAsDate ( DOB ))/365.25 ; 1 ) ; "  But where exactly do you put it.... so I use the filed name DOB or age?
Once in database mode if I use DOB  do I click on Options? then cal value and the click on age and in the filed paste the cal code???

Sorry my first time, I work Fire Rescue and on duty today, Been busy which is why I did not answer your post sooner.

Again,
Thank you very much for your help
Avatar of noad
noad
Flag of United States of America image

ASKER

Willlmcn

Maybe this will help you understand what I'm doing wrong...

Thanks
Screen-shot-2011-05-15-at-12.40..jpg
Avatar of Will Loving
Will Loving
Flag of United States of America image

You've almost got it you've just got things reversed a little. You have a field called D.O.B., which is presumably a Date field (I would get rid of the periods but that's not a critical issue). You are going to create a new field called "Age" with a field type of Calculation. When you create a calculation field, FileMaker immediately opens the Specify Calculation dialog box.

It looks like in your screen shot you are attempting to convert your D.O.B. field to a calc, which is NOT what you want. The error is coming up because you have change the Get(CurrentDate) function, one of FileMaker's many "Get" functions to something that FM doesn't recognize as a function.

So, to make this work, go back to the list of fields, type in "Age" as the field name, set the field Type to Calculation, and then click "Create". In the Specify Calculation dialog, enter the calculation I gave you and substitute in "D.O.B." for my "DOB" field (or just eliminate the periods in your D.O.B. field name).
Avatar of noad
noad
Flag of United States of America image

ASKER

Well that was easy....

Thank you so much, but plz don't hate me.... :(

I see a problem

ie.. my B/D is on 09.26/1966 I'm currently 44, if I input that it rounds off and the cal given is 45, which is not correct.
Can this be fixed?
If so can you tell me how?
Screen-shot-2011-05-15-at-11.43..jpg
Avatar of Will Loving
Will Loving
Flag of United States of America image

You are absolutely correct and I never caught that the rounding would be rounding up for any decimal .5 and above. So assuming you don't care about partial years, here's how you do it:


Int( ( Get ( CurrentDate ) -  GetAsDate ( DOB )) / 365.25 )

"Int" is the Integer function, which just means that it gives you the whole number part of the result of any calculation ignoring any remainder.
ASKER CERTIFIED SOLUTION
Avatar of Will Loving
Will Loving
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of noad
noad
Flag of United States of America image

ASKER

WOW....
I'm just starting, my real background is Saving life and property in that order LOL
 
Really,

Apart from the Fire Rescue my main thing is Networking, setting up server ect....

I'm doing this as a project for my Dept in an effort to be a paperless as possible.

Thank you very much for your help.

FYI
Im going to post another question about how to create and have an e-mail on the form to be able to e-mail the Pt report to the hospital so that when we arrive the ER has the Pt info already.


If you have the time I really like your input.

Again,
Thank you very much!

Avatar of noad
noad
Flag of United States of America image

ASKER

By far this has been one of the issue that I felt completely lost in, but the simple examples made it extremely easy.
Avatar of noad
noad
Flag of United States of America image

ASKER


 I just posted the e-mail question...

Hope to hear from you.

Again

THANKS!
FileMaker Pro
FileMaker Pro

FileMaker Pro is a cross-platform relational database application that integrates a database engine with a graphical user interface (GUI) and security features, allowing users to modify the database by dragging new elements into layouts, screens, or forms. FileMaker evolved from a DOS application, but since 1992 has been available for Microsoft Windows and Mac OS, and can be used in a cross-platform environment.

4K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo