Age Calc Help please

I have a formula that was given to me a few years ago.It has worked
well until I updated to FMP 9 and now it is not returning the correct
results:

Case (

GetAsNumber ( DOB ) > GetAsNumber ( Date ); "Unborn";
GetAsNumber ( DOB ) = "" or GetAsNumber ( Date ) = "";"";
Date - DOB <= 30 ; Date - DOB & Case( Date - DOB = 1 ; "day" ; "
days" ) ;
( Year( Date - DOB ) - 1 ) * 12 + ( Month( Get ( CurrentDate ) - DOB )
- 1 ) < 13 ;
( Year( Date - DOB ) - 1 ) * 12 + ( Month( Get ( CurrentDate ) - DOB )
-1 ) & " mo" ;

Year( Date - DOB ) - 1 & " yr" )


Recently I updated to FMP 9 and it is now returning wrong values for
months - i.e. between 10 and 12 months it will say 1 or 2 when really
it should be 11 or 12.

Can you think what might be the problem?

Also is there any way that it could give me the age in Months and
years right up to 24 months i.e for anything up to that 16 ... 23
months and after that back to 2, 3 , 4... years

Thanks in advance if you can help

Regards

John
J T [ Di, 04 Dezember 2007 20:57 ] [ ID #1885326 ]

Re: Age Calc Help please

In article
<0e464a95-bf57-40fa-8e11-53a7a86bb293 [at] l1g2000hsa.googlegroups.com>,
J T <jtdoherty [at] lineone.net> wrote:

> I have a formula that was given to me a few years ago.It has worked
> well until I updated to FMP 9 and now it is not returning the correct
> results:
>
> Case (
>
> GetAsNumber ( DOB ) > GetAsNumber ( Date ); "Unborn";
> GetAsNumber ( DOB ) = "" or GetAsNumber ( Date ) = "";"";
> Date - DOB <= 30 ; Date - DOB & Case( Date - DOB = 1 ; "day" ; "
> days" ) ;
> ( Year( Date - DOB ) - 1 ) * 12 + ( Month( Get ( CurrentDate ) - DOB )
> - 1 ) < 13 ;
> ( Year( Date - DOB ) - 1 ) * 12 + ( Month( Get ( CurrentDate ) - DOB )
> -1 ) & " mo" ;
>
> Year( Date - DOB ) - 1 & " yr" )
>
>
> Recently I updated to FMP 9 and it is now returning wrong values for
> months - i.e. between 10 and 12 months it will say 1 or 2 when really
> it should be 11 or 12.
>
> Can you think what might be the problem?
>
> Also is there any way that it could give me the age in Months and
> years right up to 24 months i.e for anything up to that 16 ... 23
> months and after that back to 2, 3 , 4... years
>
> Thanks in advance if you can help
>
> Regards
>
> John

I use a very simple-minded formula to calculate age:

int((Date1 - Date2)/365.25)

in which Date1 represents today's date or some other event date, and
Date2 represents the birthdate

--
Bill Collins
For email, change "fake" to "earthlink"
bill [ Mi, 05 Dezember 2007 00:59 ] [ ID #1886217 ]

Re: Age Calc Help please

J T wrote:
> I have a formula that was given to me a few years ago.It has worked
> well until I updated to FMP 9 and now it is not returning the correct
> results:
>
> Case (
>
> GetAsNumber ( DOB ) > GetAsNumber ( Date ); "Unborn";
> GetAsNumber ( DOB ) = "" or GetAsNumber ( Date ) = "";"";
> Date - DOB <= 30 ; Date - DOB & Case( Date - DOB = 1 ; "day" ; "
> days" ) ;
> ( Year( Date - DOB ) - 1 ) * 12 + ( Month( Get ( CurrentDate ) - DOB )
> - 1 ) < 13 ;
> ( Year( Date - DOB ) - 1 ) * 12 + ( Month( Get ( CurrentDate ) - DOB )
> -1 ) & " mo" ;
>
> Year( Date - DOB ) - 1 & " yr" )
>
>
> Recently I updated to FMP 9 and it is now returning wrong values for
> months - i.e. between 10 and 12 months it will say 1 or 2 when really
> it should be 11 or 12.
>
> Can you think what might be the problem?
>
> Also is there any way that it could give me the age in Months and
> years right up to 24 months i.e for anything up to that 16 ... 23
> months and after that back to 2, 3 , 4... years
>
> Thanks in advance if you can help
>
> Regards
>
> John
Give this formula a go.

Year ( Get ( CurrentDate ) ) - Year ( DOB ) - (DayOfYear ( Get (
CurrentDate ) ) < DayOfYear ( DOB )) & " years and " &

Case (

DayOfYear ( Get ( CurrentDate ) ) ≥ DayOfYear ( DOB ); DayOfYear (
Get ( CurrentDate ) ) - DayOfYear ( DOB );

DayOfYear ( Get ( CurrentDate ) ) + (DayOfYear(Date(12;31;Year (
Get ( CurrentDate ) )) - DayOfYear ( DOB )))) & " days"

M Myett
The other Mike [ Mi, 05 Dezember 2007 03:58 ] [ ID #1886218 ]
Datenbanken » comp.databases.filemaker » Age Calc Help please

Vorheriges Thema: Text comparison in FMP5
Nächstes Thema: storing settings and user preferences