Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Bad Date Format String error Post Reply Post New Topic
Author Message
ricky_vegas
Newbie
Newbie


Joined: 03 Jan 2008
Location: United States
Online Status: Offline
Posts: 15
Quote ricky_vegas Replybullet Topic: Bad Date Format String error
    Posted: 04 Jan 2008 at 10:50am
I have three fields: date_ordered, date_wanted, date_shipped. For all three the data type is char!
 
I need to calculate the days between date_wanted - date_ordered and date_shipped - date_ordered.
 
In Crystal XI I created three formulas @date_wanted (CDate({JC10.DATE_WANTED}), etc.
 
date_ordered and date_wanted are working just fine but date_shipped is giving me  a "Bad date format string" error. The only thing I can think about is that date_shipped has empty records. If this is the problem, how can I take care of it? In other words, if I haven't shipped one or more items how can I tell the system to give me the difference between date_wanted - date_ordered but not date_shipped - date_ordered?
 
thanks in advance.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 06 Jan 2008 at 8:29pm
I would use the IsNull() function to test if the field is empty. If so, don't subtract the dates and instead just return 0 as the formula result.

I cover handling null values in Chapter 7 and I cover all the date functions in Chapter 6 of my book Crystal Reports Encyclopedia
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 07 Jan 2008 at 4:30am
Also check through your data for non-date values.  When I've worked with databases that store dates as text in the past, users have a distressing tendency to enter "TBD" or "ASAP."  You can use the IsDate function to test if the value is a date.


IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.