calculating exact age and workingyears

Nancy Palmquist nlp at vss3.com
Wed Nov 24 06:46:58 PST 2004


Peter Klaassen - NCC vof wrote:

> For this I use in the automatic processing:
> 
> :'employmentdate is 10,DMYY/
> :'birthdate is 10,DMYY/:
> :
> :ja(6,.3);la(6,.3);jr(2,.0);lt(2,.0):
> :
> :ja=((@td-employmentdate)/"364.25");la=((@td-birthdate)/"364.25"):
> :
> :jr=ja;lt=la:
> :@td lt (mid(employmentdate,"1","6"){mid(@td,"7","4"))
> :jr=ja-"1":
> :@td lt (mid(birthdate,"1","6"){mid(@td,"7","4"))
> :lt=la-"1":
> 
> calculating total amount op days, deviding by 364.25 into an
> .3 variable, placing it in a .2 varibale concluding by checking if 
> todaysdate is less than the birthdaydate.
> this however not always results in the correct figures.
> I can't trace the error I make.
>  
> 
> isn't there an easier way within filepro processing in presenting the 
> exact age and/or years op employment?

Peter,

Try this routine.  It will give you the correct age of a person.  Field 
6 is the Date of Birth with edit: (10,mdyy/).  The age is compared to 
the @t4 (today's date in 10 digit format)

Years of employment should be easy.  Years = (Current Date - Hire 
Date)/"365.25"

You may need to round or adjust the edits to get the calculation just right.

Age of a person.

        Then: declare pat_age(3,.0),loadqq(10,mdyy/),byear(4,.0),a
266  -------   -   -   -   -   -   -   -   -   -   -   -   -   -
        ◄ If:
        Then: loadqq =6;gosub ptag;return
267  -------   -   -   -   -   -   -   -   -   -   -   -   -   -

271  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
ptag   ◄ If: loadqq=""                                                 ◄
        Then: pat_age="";qg(3,.0)=""; return                            ◄
272  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
        ◄ If:     '   year of birth                                    ◄
        Then: byear=mid(@t4,"7","4"); qg=byear-mid(loadqq,"7","4")     ◄
273  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
        ◄ If: mid (@t4,"1","2") lt mid(loadqq,"1","2")   'month of birth◄
        Then: qg=qg-"1"                                                ◄
274  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
        ◄ If: mid(@t4,"1","2") eq mid(loadqq,"1","2") and
		mid(@t4,"4","2") lt mid(loadqq,"4","2")
       Then: qg=qg-"1" 
        75  -------   -   -   -   -   -   -   -   -   -   -   -       ◄
         If:                                                           ◄
        Then: pat_age=qg;return                                        ◄

-- 
Nancy Palmquist
Virtual Software Systems
PHONE: (412) 835-9417			Web site:  http://www.vss3.com



More information about the Filepro-list mailing list