I need some help on a report.
I am using Ken Hamady's Age Formula (http://www.kenhamady.com/form06.shtml) Unfortunately, Ken's formula doesn't look at weeks or months of age.
WhileReadingRecords;
DateVar Birth:= date({SB1001_main.PatientBirthdate}); // Replace this with your field for Date Of Birth
DateVar Ann := date({SB1001_main.ApptStart}); // Replace this with CurrentDate to get their age as of the time of the report
//or the date field of an event to get their age as of the time of that event.
if (Month(Ann) * 100) + Day (Ann) >=(Month(Birth) *100) + Day (Birth)
then Year (Ann) - Year(Birth)
else Year (Ann) - Year(Birth) -1
My report currently has 5 detail bands (A - E) and each utilize the @Age formula.
Birth to 6 yrs Old. (Details A)
Female 7 - 18 yrs old (Details B)
Male 7 - 18 yrs old (Details C)
Adult Female (over 18 yrs old) (Details D)
Adult Male (over 18 yrs old) (Details E)
Its seems the weeks and months at certain levels trigger the wrong form. I just came across an 8 week old and a 7 month old that were incorrect and printing the 7-18 yr forms. Perhaps I should rework this entirely to pull the right form. Any questions, please ask. I appreciate any help!
Right now, I have the following suppress statements set-up:
det_a:
{@Age} > 6
det_b:
{SB1001_main.PatientSex} = 'M' or
{@Age} < 7 or
{@Age} > 18
det_c:
{SB1001_main.PatientSex} = 'F' or
{@Age} < 7 or
{@Age} > 18
det_d:
{SB1001_main.PatientSex} = 'M' or
{@Age} < 19
det_e:
{SB1001_main.PatientSex} = 'F' or
{@Age} < 19