Results 1 to 5 of 5

Thread: Need help calculating Age in FileMaker Pro

  1. #1
    Join Date
    Mar 2010
    Posts
    71

    Need help calculating Age in FileMaker Pro

    I am using FileMaker Pro for my business purpose and I would like to know the age of an employee with the help of the data of birth provided by him/her. I am not used to with this database application and so I need your help. I tried it by entering the birth date in one field and keeping the other field to calculate the age of the employee and display it to me. But the problem it that it is not working. Where is the actual problem? Can you help me out?

  2. #2
    Join Date
    May 2008
    Posts
    860

    Re: Need help calculating Age in FileMaker Pro

    Here is how you do it. Create a field in the database of type Date. You may call it as DOB. Now create another filed for calculation purpose and call it as Age. Now you have to add a formula to the calculation field as below to let it calculate the age of the employee using system date:
    Code:
    If (Month(Get(CurrentDate))<Month(DOB);Year(Get(CurrentDate))-Year(DOB)-1;Year(Get(CurrentDate))-Year(DOB))
    To explain you what this code it all about, it basically checks the current month against the DOB month and if it is before that month then it calculates the age in years and then subtracts one from it. In other case, the age is calculated in year.

  3. #3
    Join Date
    May 2008
    Posts
    979

    Re: Need help calculating Age in FileMaker Pro

    I think you didn't added any formula or may be the logic is wrong for age calculation. The idea behind the calculation should go as follows:

    Compare the month of the system date with the month appearing in the date of the birth field. If the first is greater than the later one then the age is the difference in the year of system date and date of birth. Else it is one less than the year of system date and date of birth.

  4. #4
    Join Date
    Nov 2008
    Posts
    1,259

    Re: Need help calculating Age in FileMaker Pro

    The above operations will fail if you will see the age of the person on his/her birthday's month. It will show you that he is one year older since the start of the month although his birthday is on 25th or so. To avoid this you can use the TRUNCATE function. It will eradicate any such possibilities. If I where to explain the above codes into a simpler langauage then both of the above states that if you subtract the date of birth of an employee with the current date, you get the age of that person. Isn't it? But what happens if there is any leap year (which is but obvious to occur) in between? I you want to calculate it also then your year consists of 365.25 days. So the age of the employee becomes:

    TRUNCATE((CurrentDate - DOB)/365.25)

    Thus you eliminate any possible errors that might occur over here in the calculation.

  5. #5
    Join Date
    May 2008
    Posts
    685

    Re: Need help calculating Age in FileMaker Pro

    Thank you Bull for your suggestion, it worked in my case. I had some similar problems but the situation was somewhat different in my case. We store the employee date of birth in a different way (for example like "19980217" instead of 1998.02.17 or similar) for simplicity with the help of a software. We then convert it with the help of a code into a date for producing the results. But the problem was that we were not getting the correct result in the reports. After seeing your post, I tried your solution and here is how what I did. I modified the code for the reports that was generating the results and it worked.

    Here is the code which I used:
    Code:
    TRUNCATE((Get(SystemDate) - GetAsDate(Middle(DOB;5;2)&"/"&Right(DOB;2)&"/"&Left(DOB;4)))/365.25;0)

Similar Threads

  1. What is new in FileMaker Pro 11
    By Maq.H in forum Windows Software
    Replies: 5
    Last Post: 10-03-2010, 11:59 AM
  2. FileMaker Vs Microsoft Access
    By jean-paul martell in forum Windows Software
    Replies: 3
    Last Post: 30-11-2009, 02:13 PM
  3. iPhone Filemaker FMTouch
    By Pratim in forum Windows Software
    Replies: 3
    Last Post: 08-09-2009, 10:33 AM
  4. Filemaker 3.0 and Vista
    By Samarth in forum Windows Software
    Replies: 3
    Last Post: 08-09-2009, 09:21 AM
  5. Help Installing the filemaker pro odbc driver
    By screwball in forum Software Development
    Replies: 2
    Last Post: 06-07-2009, 10:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,107,968.04519 seconds with 17 queries