sharabi Posted June 3, 2013 Posted June 3, 2013 I would like to be able to calculate age and report according to the guideline shown (knowing i input the hour of birth besides the day/month/year: I would like to be allowed the recording of date and time of birth (hour and minutes if known) and subsequently be able to express age in hours for the first 4 days of life, then in days from the 5th day of life through the first 28 days, then in weeks beginning on the 29th day of life through the first three completed months of life, and then in months beginning with the 4th month of life through age 2 years. Subsequent expressions of age may be expressed by year and month (2 years 6 months) or with a decimal place for expressing part of years (i.e. 2.5 years old) through age 18.
Fitch Posted June 3, 2013 Posted June 3, 2013 If you subtract one timestamp from another, you get the number of seconds difference. Divide by 60 to get minutes, etc. Is that enough to get you started? You might want to look over on briandunning.com to see if anyone's already made a function for this, or at least something similar. 1
Lee Smith Posted June 3, 2013 Posted June 3, 2013 Have you performed search for Age Calculations? Since this topic comes up every so often, you can find several treads on the subject by doing this search site: fmforums.com age There several custom functions having to do with age calculation at briandunning.com Most of these custom functions can be used in regular calculation field. HTH Lee
sharabi Posted June 5, 2013 Author Posted June 5, 2013 I could not find my answer in the referred site(s). Thank you
Lee Smith Posted June 5, 2013 Posted June 5, 2013 First of all, a disclaimer. You will not find a perfect age calculation. However, maybe this one will get you close - Elapsed
sharabi Posted June 6, 2013 Author Posted June 6, 2013 Thank you very much i have this function already in my solution however the CCHIT certification requires the function i posted above to pass the test. it is related to pediatric age and you may have newborns with age of hours.
doughemi Posted June 6, 2013 Posted June 6, 2013 You will have to use a Case statement. Let( [~under4days = <calculation of age in hours>; ~under28days = <calculation of age in days>; ~under3months = <calculation of age in weeks>; ~under2years = <calculation of age in months>; ~over2years = <calculation of age in years and months> ]; Case( Date(Get(CurrentTimestamp)) - Date(BirthTimestamp) > 730; ~over2years; Date(Get(CurrentTimestamp)) - Date(BirthTimestamp) > 90; ~under2years; <etc> ) ) The calculations would be derived from the hints given by Lee and Fitch.
Rick Whitelaw Posted June 7, 2013 Posted June 7, 2013 But Under 4 days, Under 28 days, and Under 3 months are ALL Under 2 years, so something like greater than 4 days AND less than 28 days etc would work. Another way would be to have the first part of the Let be a Case statement. That way the first true value would be evaluated.
doughemi Posted June 7, 2013 Posted June 7, 2013 You're partly right. As written, all of the age formats are calculated, and then the correct one is chosen by the Case statement. I wrote it that way to make it clearer what is happening without having to build all the calculations and/or adding comments. By evaluating the Case from highest to lowest (with ">" operators), it automatically takes care of the "and less than..." part. But I agree the most efficient way is to write it as Case( Date(Get(CurrentTimestamp)) - Date(BirthTimestamp) > 730; <calculation of age in years and months>; Date(Get(CurrentTimestamp)) - Date(BirthTimestamp) > 90; <calculation of age in months>; <etc> ) 1
Fitch Posted June 10, 2013 Posted June 10, 2013 If you're optimizing, you'd only want to calculate Date(Get(CurrentTimestamp)) - Date(BirthTimestamp) once. 1
Recommended Posts
This topic is 4241 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now