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 5173 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have my patients database, with one of the fields is "age", of course.

For young patients, I would like to enter the age in this format: "5m"; "10d"; "2y 3m", and yet, theses entries need to be calculated, internally as decimal numbers when I do my statistics.

Currently i calculate the number manually and enter it as a decimal number i.e. 5 months = 5/12 = 0.42, which is cumbersome for the secretaries and it does not look harmonious when printing the record of the patient.

Please help.

Posted

I think your best option would be to enter their birthday, then let their age be a calculated field. If you did it this way, the age calculated field could be formatted however you'd like on reports. For example:


Let(

age = TransactionDate-Birthday;

Case(

    age < 365 ;  // less than one year

    age / 12 & "m";

ect...

))

The only other way I can think of doing this is by using a Custom Function or script triggers, which you don't have in FileMaker 9. Both of those methods are more complicated though.

Posted

The DOB is a very good idea; however, it is not available most of the time. Your calculation seems to do part of the job. If you can please complete the calculation for me to show age in years only for ages > 5; to show years and months for ages 1-5 years; and to show months and days for < 1 year of age.

For example entering 11/21/2000, should show "10y"

Entering 1/1/2003 should show: "7y 11m"

Entering 2/2/2010 should show: "9m 18d"

Thanks again

Posted

You need to define "month". A child born on Feb 1, could be one month old on Mar 1. By the same logic, a child born on Mar 1, would become a month old on Apr 1. Thus you have 28 days = 1 month, and 31 days = 1 month.

Using another system (perhaps better suited to pediatrics) a child would become one month old when 30 days have elapsed since its birth.

Posted

Try =


Let ( [

n = VisitDate - DOB + 1;

y = Div ( n ; 365.2425 ) ;

r = Mod ( n ; 365.2425 ) ;

m = Div ( r ; 30.436875 ) ;

d = Round ( Mod ( r ; 30.436875 ) ; 0 )

] ;

Trim ( Case ( y ; y & "y ") & Case ( y < 5 ; m & "m " ) & Case ( y < 1 ; d & "d" ) )

)

Posted

dear comment,

Very nicely done. I'm so grateful.

I have two questions:

Is there a problem not adding one day to age.

Secondly, as far as searching this field, would it be possible to find patients by age range?

Posted

Is there a problem not adding one day to age.

No, and it would probably be better for this type of usage.

as far as searching this field, would it be possible to find patients by age range?

I think it would be awkward. I would split the calculation into two: have a field that return the number of elapsed days, and another that formats this as shown above. Then translate your criteria into a range of days and search the first field.

This topic is 5173 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.