December 5, 200223 yr Newbies I'm designing a Client database that has a date field of the person's birthday. I also have an age field that I would like to be filled in auto as soon as I enter the client's birth date. I would like the age field to tell me how old they are in years. I know it is a calculation but having trouble configuring it. Help...thanks alot.
December 5, 200223 yr Hi: Define a calc field called age: Year(Status(CurrentDate) - Year(Birthdate). Result should be a number. Ken
December 5, 200223 yr I prefer this formulation: Age = Year(Status(CurrentDate)) - Year(Birthdate) - (Status(CurrentDate) < Date(Month(Birthdate), Day(Birthdate), Year(Status(CurrentDate)))) but you'll find many other formulations in past threads on these forums.
December 7, 200223 yr Author Newbies Thanks, I will try them both and see which one works best for my situation. Greg
December 9, 200223 yr Make sure that you have chosen 'Do not store calculated results, calculate only when needed' or else the age calculated initially will remain the same and not update once a birthday has passed. (Can someone with greater FM knowledge please confirm that this is correct !! Thanks)
December 9, 200223 yr Hi Tom, unless you are triggering the field to force update the answer is yes: the unstored calc will update otherwise you'll get age when first calculated Dj
December 9, 200223 yr Hi Brian! Could you explain to me why you have two sides to this? I understand current year less birthday year ... but I don't understand what you are fine-tuning with ... LESS (current date LESS THAN (?) birthday date w/current year(?). Will this result in the number of additional days? Less than? Am I reading this wrong? LaRetta
December 9, 200223 yr Assuming that today is 12/09/2002 and that someone birthdate is 12/24/1969 than Year(Status(CurrentDate)) - Year(Birthdate) would give 33 against Year(Status(CurrentDate)) - Year(Birthdate) - (Status(CurrentDate) < Date(Month(Birthdate), Day(Birthdate), Year(Status(CurrentDate)))) which would give 32. So the right way to use the formula should be= Case(Sex="F",Year(Status(CurrentDate)) - Year(Birthdate) - (Status(CurrentDate) < Date(Month(Birthdate), Day(Birthdate), Year(Status(CurrentDate)))),Year(Status(CurrentDate)) - Year(Birthdate)) Dj
December 9, 200223 yr Hi DJ! How Funny!! Well, this DID throw me - thanks for explaining. So you only used the Case because of the Sex="F" portion? Is that also why you have the additional string at the end? Because Case needs a result (and it must be a number, right)? Thanks for explaining the formulae, although I still don't understand why that '<' is there ... I'll work on it! LaRetta
December 10, 200223 yr Just subtracting the years tells you how old you will be this year, on or after your birthday. Until your birthday comes, you are still the age you turned last year. Soooo, the simple subtraction of years tells us the age you will turn this year. Now we simply need to subtract one if you haven't yet had your birthday this year... that is, if today's date is before your birthday this year, then we need to subtract one. Sooo, since true = 1 and false = 0, I simply subtract the result of that test. The expression: (Status(CurrentDate) < Date(Month(Birthdate), Day(Birthdate), Year(Status(CurrentDate))) returns 1 if I need to subtract 1 and 0 if I need to subtract 0. So, I just subtract it. Some might find this formulation more readable... I just find it longer: Age = Year(Status(CurrentDate)) - Year(Birthdate) - If(Status(CurrentDate) < Date(Month(Birthdate), Day(Birthdate), Year(Status(CurrentDate))), 1, 0) HTH.
December 10, 200223 yr Oh Brian! Thank you so much for explaining this to me! Now it makes total sense. I have trouble with formulas ... thinking them through in *real* words and you said it beautifully. I appreciate all you give on this Forum! God, I love this Forum and FileMaker! LaRetta
Create an account or sign in to comment