Link to home
Start Free TrialLog in
Avatar of cswebdev
cswebdev

asked on

Crystal Reports CDate Error

I am using Crystal 9.  I have the following formula:
CDATE(mid({Military_calls.Code},6,2)+"/"+mid({Military_calls.Code},8,2)+"/"+mid({Military_calls.Code},10,2))

The code that it is using is AVAIL07307NR.  When it gets an error because it cannot convert this information to a date, it will not return any information back to the report.  How can I put some kind of "IF" statement around this to say that if there is an error, just return a blank date to the report, but keep processing?
Avatar of Kurt Reinhardt
Kurt Reinhardt
Flag of United States of America image

So, basically this is a problem with your data not being in the expected format?  If the data isn't in the expected format is it in some other format consistently (for example, you only have five numeric values above when your formula expected six)?  If so, might be easier to capture the errors.

While I can see the need to report around the errors, my preferred approach--personally--would be to scrub the existing data and correct the data capture/input methodology.  I believe in the GIGO philosophy in regards to reporting, Garbage In - Garbage Out...  It's much more efficient and more easily maintainable to write to the norm than it is to write to the exception.

~Kurt
Avatar of cswebdev
cswebdev

ASKER

Unfortunately, I don't have any control over the input.  This is entered by users outside of my area, and there is no consistent way that they enter the data.  That's why I need some way of knowing that the information can't be converted to a data and returning a blank string instead.
ASKER CERTIFIED SOLUTION
Avatar of Kurt Reinhardt
Kurt Reinhardt
Flag of United States of America image

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
No, there is no consistent length for the entire field.
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
This pointed me in the right direction!  I got the report to run.

Thanks!