Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal Reports, 10, @Age Suppress Statement Post Reply Post New Topic
Author Message
JeffS23
Newbie
Newbie
Avatar

Joined: 02 Nov 2007
Location: United States
Online Status: Offline
Posts: 8
Quote JeffS23 Replybullet Topic: Crystal Reports, 10, @Age Suppress Statement
     Posted: 02 Jan 2008 at 12:28pm
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
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 03 Jan 2008 at 5:07am
I would start with some basic troubleshooting.

Did you verify that the data on those two cases was actually correct?  Is there a spot on the form where you actually return the results of the @Age formula?  If not, I would add one, at least temporarily, to see what it is returning.  That may help narrow down where the issue is.

Did you copy and paste the above formulas?  If yes, they look fine.  If not, double-check them for typos.  Especially check for parentheses, and that all of your operators are pointed the right direction.

If you still are having trouble narrowing it down, I recommend you create a new blank report, using the same datasource.  As your fields, put the BirthDate, ApptDate, Month, Year, and Day of each of those, and the results of the @Age formula for all the patients.  Perhaps your formula is switching the month and day values?  Perhaps the date on your computer is incorrect, and it is throwing off any CurrentDate calculations?  Perhaps there is sunspot activity?


IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum