Error while checking date

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Error while checking date

Post by rafidwh »

Hi All,

I am validating a date using isValid function,I am getting an error when the date is invalid.

The input date format is dd/mm/yyyy
The function used is IsValid("DATE", StringToDate(DSLink3.Date,"%dd/%mm/%yyyy")

Now if the date is 32/32/2008 or 00/00/0000 then it gives a warning

:"Conversion error calling conversion routine date_from_string data may have been lost"

Please suggest me why this warning is getting and how to validate if it is invalid.

Thanks in advance

Regards,
Rafidwh
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

Use an If Then Else statement. if valid Then () Else default value. Something like that.
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Post by rafidwh »

I am using If then Else,but getting the same warning
G SHIVARANJANI
Participant
Posts: 137
Joined: Sun Jan 07, 2007 11:17 pm
Location: VISAKHAPATNAM

Post by G SHIVARANJANI »

Try this:

If
StringToDate(DSLink3.Date,"%dd/%mm/%yyyy")[1,2] = '**' then 0 else 1

Maveric wrote:Use an If Then Else statement. if valid Then () Else default value. Something like that.
Shivaranjani
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Post by rafidwh »

Getting the same warning

Conversion error calling conversion routine date_from_string data may have been lost
G SHIVARANJANI
Participant
Posts: 137
Joined: Sun Jan 07, 2007 11:17 pm
Location: VISAKHAPATNAM

Post by G SHIVARANJANI »

Please Do NullHandling In stage variable and then go ahead with validation:

like:

If Trim(DSLink3.Date) = '' then 0
else If StringToDate(Trim(DSLink3.Date),"%dd/%mm/%yy")[1,2]= '**'
Then 0
else 1

rafidwh wrote:Getting the same warning

Conversion error calling conversion routine date_from_string data may have been lost
Shivaranjani
G SHIVARANJANI
Participant
Posts: 137
Joined: Sun Jan 07, 2007 11:17 pm
Location: VISAKHAPATNAM

Post by G SHIVARANJANI »

If IsNull(DSLink3.Date) then 0
else If StringToDate(Trim(DSLink3.Date),"%dd/%mm/%yy")[1,2]= '**'
Then 0
else 1

G SHIVARANJANI wrote:Please Do NullHandling In stage variable and then go ahead with validation:

like:

If Trim(DSLink3.Date) = '' then 0
else If StringToDate(Trim(DSLink3.Date),"%dd/%mm/%yy")[1,2]= '**'
Then 0
else 1

rafidwh wrote:Getting the same warning

Conversion error calling conversion routine date_from_string data may have been lost
Shivaranjani
Post Reply