dbTalk Databases Forums  

age in months

comp.databases.filemaker comp.databases.filemaker


Discuss age in months in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Lawrence Leichtman
 
Posts: n/a

Default age in months - 07-08-2005 , 09:25 AM






I want to display the exact age of my patients in months using a
calculation field. The discusssion of calculation for age in years goes
back a long way but anyone know a way to get it to display the exact
fraction of a year or the age in months?

Reply With Quote
  #2  
Old   
Lawrence Leichtman
 
Posts: n/a

Default Re: age in months - 07-08-2005 , 01:48 PM






Good point about what is a month. I guess it will have to be 30.4 days
as there is no good way to do it otherwise. The reason is that
developmental testing results need to be based on age in months. I guess
it does not have to be exactly on.

n article <slrndct47v.kt4.t-use (AT) ID-685 (DOT) user.individual.de>,
Martin Trautmann <t-use (AT) gmx (DOT) net> wrote:

Quote:
On Fri, 08 Jul 2005 10:25:34 -0400, Lawrence Leichtman wrote:
I want to display the exact age of my patients in months using a
calculation field. The discusssion of calculation for age in years goes
back a long way but anyone know a way to get it to display the exact
fraction of a year or the age in months?

What IS the exact age in months? Is a month 28, 29, 30 or 31 days? Is it
30.43 days?

However, I guess your question is

let(
now = get(currentDate);
years = year(now) - year (birthday);
last months = month(now)
first months = month(birthday);

years * 12
+ last months
- first months
)


Now the question is how you want to deal with the very first month and
the days of the current month. Maybe you want to check whether day(now)
is below day(birthday) and subtract this from the total.

You got the idea? Otherwise please provide some example numbers what you
do expect as result.

- Martin

Reply With Quote
  #3  
Old   
42
 
Posts: n/a

Default Re: age in months - 07-09-2005 , 05:11 PM



In article <slrndd0emd.5ca.t-use (AT) ID-685 (DOT) user.individual.de>, t-
use (AT) gmx (DOT) net says...
Quote:
On Fri, 08 Jul 2005 14:48:11 -0400, Lawrence Leichtman wrote:
Good point about what is a month. I guess it will have to be 30.4 days
as there is no good way to do it otherwise.
Yes there is. Do it the way any reasonable human being would do it if
they had to do it manually: by adding 1 month for each monthly
anniversary that is reached.

Quote:
The reason is that
developmental testing results need to be based on age in months. I guess
it does not have to be exactly on.
It probably doesn't have to be, but why settle for less?

Quote:
Then the result is easy: (now - birthday) / 30.4
I'd be much happier with Martin's earlier suggestion finished off:

Let(
[birthday = datex;
now = datex Copy;
years = Year(now) - Year (birthday);
last months = Month(now);
first months = Month(birthday);
threshold = Day(birthday)<=Day(now)];

years * 12 + last months - first months + threshold -1)

(It needs to be tested, but I think it should work right.)

No one should be satisfied that a child born 2/10/2005 is still listed
at being only 2 months old on 5/11/2005.

Stuff like that seriously undermines faith in the validity of the
software, even if its technically 'accurate enough'. Were I a tester not
in the 'know' looking at that result I'd report it as a major bug.

-regards,
Dave


Reply With Quote
  #4  
Old   
Lawrence Leichtman
 
Posts: n/a

Default Re: age in months - 07-10-2005 , 02:52 PM



I will give it a try and see how it works.

In article <MPG.1d39eb7c22b7393d989bdd (AT) shawnews (DOT) vf.shawcable.net>,
42 <nospam (AT) nospam (DOT) com> wrote:

Quote:
In article <slrndd0emd.5ca.t-use (AT) ID-685 (DOT) user.individual.de>, t-
use (AT) gmx (DOT) net says...
On Fri, 08 Jul 2005 14:48:11 -0400, Lawrence Leichtman wrote:
Good point about what is a month. I guess it will have to be 30.4 days
as there is no good way to do it otherwise.

Yes there is. Do it the way any reasonable human being would do it if
they had to do it manually: by adding 1 month for each monthly
anniversary that is reached.

The reason is that
developmental testing results need to be based on age in months. I guess
it does not have to be exactly on.

It probably doesn't have to be, but why settle for less?

Then the result is easy: (now - birthday) / 30.4

I'd be much happier with Martin's earlier suggestion finished off:

Let(
[birthday = datex;
now = datex Copy;
years = Year(now) - Year (birthday);
last months = Month(now);
first months = Month(birthday);
threshold = Day(birthday)<=Day(now)];

years * 12 + last months - first months + threshold -1)

(It needs to be tested, but I think it should work right.)

No one should be satisfied that a child born 2/10/2005 is still listed
at being only 2 months old on 5/11/2005.

Stuff like that seriously undermines faith in the validity of the
software, even if its technically 'accurate enough'. Were I a tester not
in the 'know' looking at that result I'd report it as a major bug.

-regards,
Dave

Reply With Quote
  #5  
Old   
42
 
Posts: n/a

Default Re: age in months - 07-10-2005 , 03:09 PM



In article <larry-14D0AE.15524810072005 (AT) news (DOT) east.cox.net>,
larry (AT) lleichtman (DOT) org says...

Quote:
[birthday = datex;
now = datex Copy;
heh... "datex" and "datex copy" are just 2 date fields I tossed together
to test with. You'll want to use your own birthday field, and now should
probably be get(currentdate), as in Martin's original suggestion.


Reply With Quote
  #6  
Old   
David Robins, MD
 
Posts: n/a

Default Re: age in months - 07-11-2005 , 02:25 AM



On 7/8/05 7:25 AM, in article larry-DBD9EC.10253408072005 (AT) new...) east.cox.net,
"Lawrence Leichtman" <larry (AT) lleichtman (DOT) org> wrote:

Quote:
I want to display the exact age of my patients in months using a
calculation field. The discusssion of calculation for age in years goes
back a long way but anyone know a way to get it to display the exact
fraction of a year or the age in months?
My hosital keeps ages in years.months format, so 6 years 11 months is 6.11,
and 6 years 2 months is 6.02 .

This is the calculation I use, and then format the field to 2 decimals. It
makes no assumptions as to the average length of a month - it gets it right
based on the calendar. Don't recall where I got this from.


Year(Get(CurrentDate)) - Year(Birth date) -
If(GetAsNumber(Get(CurrentDate))< Date(Month(Birth date); Day(Birth date);
Year(Get(CurrentDate)));1;0)&"."&
..01*Mod(Month(Get(CurrentDate)) - Month(Birth date) + 12 -
If(Day(Get(CurrentDate)) < Day(Birth date);1;0); 12)



Reply With Quote
  #7  
Old   
billholt
 
Posts: n/a

Default Re: Re: age in months - 07-13-2005 , 01:36 AM



"" wrote:
Quote:
On 7/8/05 7:25 AM, in article
larry-DBD9EC.10253408072005 (AT) new...) east.cox.net,
"Lawrence Leichtman" <larry (AT) lleichtman (DOT) org> wrote:

I want to display the exact age of my patients in months
using a
calculation field. The discusssion of calculation for age in
years goes
back a long way but anyone know a way to get it to display
the exact
fraction of a year or the age in months?

My hosital keeps ages in years.months format, so 6 years 11
months is 6.11,
and 6 years 2 months is 6.02 .

This is the calculation I use, and then format the field to 2
decimals. It
makes no assumptions as to the average length of a month - it
gets it right
based on the calendar. Don't recall where I got this from.


Year(Get(CurrentDate)) - Year(Birth date) -
If(GetAsNumber(Get(CurrentDate))< Date(Month(Birth date);
Day(Birth date);
Year(Get(CurrentDate)));1;0)&"."&
..01*Mod(Month(Get(CurrentDate)) - Month(Birth date) + 12 -
If(Day(Get(CurrentDate)) < Day(Birth date);1;0); 12)
This works, where Now and DOB are both date fields.

Case (

Month ( Now ) - Month ( DOB ) >= 0 ;

Month ( Now ) - Month ( DOB ) + ( Year ( Now ) - Year ( DOB ) ) * 12 ;

12 - ( Month ( DOB ) - Month ( Now ) ) + ( Year ( Now ) - Year ( DOB )
- 1 ) * 12

)

--
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/FileMaker-ag...ict238674.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=833915


Reply With Quote
  #8  
Old   
Lawrence Leichtman
 
Posts: n/a

Default Re: age in months - 07-13-2005 , 07:52 AM



Yes, that works for me just fine. thanks

In article <4_833915_14b6d4879490f6a229c7300eb13ad199 (AT) dbforumz (DOT) com>,
billholt <UseLinkToEmail (AT) dbForumz (DOT) com> wrote:

Quote:
"" wrote:
On 7/8/05 7:25 AM, in article
larry-DBD9EC.10253408072005 (AT) new...) east.cox.net,
"Lawrence Leichtman" <larry (AT) lleichtman (DOT) org> wrote:

I want to display the exact age of my patients in months
using a
calculation field. The discusssion of calculation for age in
years goes
back a long way but anyone know a way to get it to display
the exact
fraction of a year or the age in months?

My hosital keeps ages in years.months format, so 6 years 11
months is 6.11,
and 6 years 2 months is 6.02 .

This is the calculation I use, and then format the field to 2
decimals. It
makes no assumptions as to the average length of a month - it
gets it right
based on the calendar. Don't recall where I got this from.


Year(Get(CurrentDate)) - Year(Birth date) -
If(GetAsNumber(Get(CurrentDate))< Date(Month(Birth date);
Day(Birth date);
Year(Get(CurrentDate)));1;0)&"."&
..01*Mod(Month(Get(CurrentDate)) - Month(Birth date) + 12 -
If(Day(Get(CurrentDate)) < Day(Birth date);1;0); 12)

This works, where Now and DOB are both date fields.

Case (

Month ( Now ) - Month ( DOB ) >= 0 ;

Month ( Now ) - Month ( DOB ) + ( Year ( Now ) - Year ( DOB ) ) * 12 ;

12 - ( Month ( DOB ) - Month ( Now ) ) + ( Year ( Now ) - Year ( DOB )
- 1 ) * 12

)

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.