Newbies moenpmn Posted February 9, 2010 Newbies Posted February 9, 2010 Hi, we're trying to use date of birth to pull out demographic reports for clients in certain age ranges (6-9 years old, for example). The age calculation we're using gives us a result that is in decimal format (2.5 years, for 2 years and 6 months, for example). We then created a calculation field that groups the clients into categories by age using the following calculation: To calculate if age falls into the 6-9 year old category (Field name=age69) If (age calculatednoblanks < "10.0" and age calculatednoblanks ≥ "6.0" ; 1 ) Then we created a summary field that totals that category. To total 6-9 year olds: Summary Field that totals field “age69” The problem is that younger ages get summarized in the categories for older ages (for example, 6-9 year olds get counted in the 65 year old category). It’s like FM does not recognize the decimal. We've tried troubleshooting every way we can think of (mostly by trying to force FM to recognize the decimal) but nothing we have tried has worked. Does anyone have any ideas? I can provide the calculation that we are using to calculate age from date of birth if that is helpful. We're two FM novices who know just enough to be dangerous, and we don't have a lot of experience with functions or anything like that. So we're hoping to find a simple solution. Any thoughts are much appreciated. Thanks!
comment Posted February 9, 2010 Posted February 9, 2010 It looks like you have a mixture of number and text type data. First, make sure that the age calculation returns a result of type Number. Then change your formula to: age calculatednoblanks < 10 and age calculatednoblanks ≥ 6
Newbies moenpmn Posted February 10, 2010 Author Newbies Posted February 10, 2010 Thanks. I checked the calculations and both the age calculation and the age group calculation are set to result in a number. The age calculation that we are using is: age=(date today - date of birth)/365 Almost all other age calculations we have seen result in # years, months and days. Is there a reason for that? Do you think that the age calculation could be part of our problem? Thanks again.
comment Posted February 10, 2010 Posted February 10, 2010 No, the reason is that you are using text constants instead of numbers: 6 < "10.0" returns False, because the comparison is done alphabetically, but: 6 < 10 returns True.
BostonBuckeye Posted February 10, 2010 Posted February 10, 2010 (edited) Try calculating years and months and then go from there. Here here is my x'Age calc - a15'D'Birth is the person's birthday and @Today is a field that I fill with current Today date. Case ( x'Age = ""; ""; x'Age = 0 ; (Month ( a15'D'Birth) - Month (@Today))-1 & "m" & " ( " & GetAsText(a15'D'Birth) & " )" ; x'Age >0 ; " " & Year ( @Today - a15'D'Birth)-1 & "y " & Month (@Today - a15'D'Birth)-1 & "m" & " ( " & GetAsText(a15'D'Birth) & " )" ; ) Edited February 10, 2010 by Guest
BostonBuckeye Posted February 10, 2010 Posted February 10, 2010 (edited) You'll need this x'Age calc also Year ( @Today - a15'D'Birth)-1 NOTE: this calc returns an integer of the persons age from 0-100 So, if today is Feb 10, 2010 and the birthdate is Oct 14, 1943 - the calc returns 66 - which is correct. Now do your calculation (x'Age >=6 and x'Age <=9) for ages 6-9 etc Edited February 10, 2010 by Guest
comment Posted February 10, 2010 Posted February 10, 2010 Year ( @Today - a15'D'Birth)-1 That's not a good way to calculate age - see: http://fmforums.com/forum/showtopic.php?tid/150087/post/150140/#150140
Newbies moenpmn Posted February 10, 2010 Author Newbies Posted February 10, 2010 That makes sense. I came into work this morning to a very excited co-worker who removed the "" and got the correct result. Thanks! Now we're working on fixing the age calculation. Thanks to all for your suggestions.
Recommended Posts
This topic is 5494 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