1 Reply Latest reply on Jul 11, 2013 6:25 AM by philmodjunk

    calculating age



      calculating age


           Could anyone help me with a calculation? I want to calculate an age. Basically I have a mother's date of birth, and her son's date of birth. I want a field that works out the mother's age when her son was born.

           Also this is the UK so dates are in dd/mm/yyyy.

           How would I write this calculation?

           Many thanks, Louise

        • 1. Re: calculating age

               Let (  [ B = YourTable::BirthDateField ;
                           T = Get ( CurrentDate )  
                        ] ;
                           Year ( T ) - Year ( B ) - ( T < Date ( Month ( B ) ; Day ( B ) ; Year ( T ) ) )

               Substitute your birthdate field in place of "YourTable::BirthDateFiel" and make sure that this is a field of type date. Also make sure to select unstored as the storage option for this calculation field or the age will not automatically update as time passes.

               And to get the mother's age at the time a child is born, substitute the child's birthdate field for Get ( CurrentDate ) in this calculation. (And then you do not need to make this an unstored calculaiton.)