Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Convert a string to a date Post Reply Post New Topic
<< Prev Page  of 3
Author Message
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Sep 2009 at 2:17pm

A few things to check.

1. Can any of the 4 fields ever be NULL or 0? If so you have to alter these or exclude them or it will crash on these.
2. Can invalid dates have been entered? For example is there any value in CUS_ARR_DATE_MM <0 or >12. This would crash it. 
 
here is a way to find the record(s) it is choking on.
Change the formula from Date() to IsDate() like ....
IsDate(totext({LECUSD.CUS_ARR_DATE_MM},0)+"/"+totext({LECUSD.CUS_ARR_DATE_DD},0)+"/"+totext({LECUSD.CUS_ARR_DATE_CC},0)+totext({LECUSD.CUS_ARR_DATE_YY},"00",0))
 
This will return a TRUE if it is a valid date and a FALSE if it is not. FALSE means it would choke on that row if you tried the Date() function.
What are the common elements tot all of the FALSE rows? That shuold explain where the error is comining in.
You can even do a quick select statement to only look at these.
I would make one fomrual field and use no date() function to just see the string and a select statment of
NOT(
IsDate(totext({LECUSD.CUS_ARR_DATE_MM},0)+"/"+totext({LECUSD.CUS_ARR_DATE_DD},0)+"/"+totext({LECUSD.CUS_ARR_DATE_CC},0)+totext({LECUSD.CUS_ARR_DATE_YY},"00",0))
)
To see only rows that come up false.
Does this help out?
IP IP Logged
<< Prev Page  of 3
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.047 seconds.