Link to home
Start Free TrialLog in
Avatar of perichards
perichards

asked on

DateTime suppress

I have a report that I need to suppress a date of 12/12/2012. Below is the crystal statement in the suppress details of the report. When I have just the first two if thens, the report runs fine. However the 3rd if then to suppress the dates does not.  The information is pulled from a SQL database and I am using CR8 for my reports. The field in the SQL database is a DateTime field. Thanks in advanced.

BooleanVar  bNotPrint := True;
IF {SchJob.JobStatus} = 0 THEN
  bNotPrint := False
ELSE
  IF IsNull ({SchJob.JobNumber}) THEN
    bNotPrint := False
ELSE
  IF {OpenJob.DueDate} = DATE(2012,12,12) THEN
    bNotPrint := False
ELSE
bNotPrint;
Avatar of frodoman
frodoman
Flag of United States of America image

Possible it's a datetime comparison to a date issue.  Try:

If CDate({OpenJob.DueDate}) = DATE(2012,12,12) Then...

This way if the DueDate is stored as 12/12/2002 11:59:59 your comparison will work...
Avatar of perichards
perichards

ASKER

Even though the SQL format of the table says datetime, the value is still stored as just a date. I am not sure if that will make a difference or not. When I added the CDate CR8 said it expected a date-time here. I amy have miss led you. Sorry. Either way I am still stuck. anything else to try?

per
Avatar of peter57r
At the risk of sounding stupid, Suppression formulas are usually written to give a value of True when you want to suppress and False when you want it to appear.
Are you taking this into account?

Pete



ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To be honest I am following a formula that was set inside a pre-built report. I am new to crystal and am a little unsure of the terminology used for their reports. I am a vb & access guy. This is all French to me. The first two are records that I do want and the third is records that I don't want. I did change it to true but the the records with the due date of 12/12/2012 still showed up on the report. Is there an order that the if..then's need to be in to suppress records properly? If there is a better way to write this I sure could use the help. Thanks again.

per
You need to change the result of the last condition to TRUE then instead of setting it to FALSE...
Is the date field in question really a date time field.  If so you will need to extract the date from the field and then compare.

Datepart({OpenJob.DueDate}) = DATE(2012,12,12)

mlmcc
Glad I could help

mlmcc