Page 1 of 1

Conversion error

Posted: Mon Jul 23, 2007 11:51 am
by rafidwh
Hi All,

I am getting the following error while converting the date

Transformer,0: Conversion error calling conversion routine date_from_string data may have been lost.

The input date column is char(10) and the format is dd/mm/yyyy.
In the transformer I am validating the input date and converting the date into yyyymmdd .the output date datatype is integer.

In transformer iam using

sv1:IsValid("Date", StringToDate(OutDate.DATE,"%dd/%mm/%yyyy"))

sv2:If (sv1 = @FALSE Or IsNull(OutDate.DATE) )Then -1 Else DateToString(StringToDate(OutDate.DATE,"%dd/%mm/%yyyy"),"%yyyy%mm%dd").

This variable sv2 is mapped to output Date column.

I am unable to find out the error.Please suggest me to resolve the warnings.

Posted: Mon Jul 23, 2007 11:55 am
by phanee_k
StringToDate function converts the date into yyyy-mm-dd.

Why do you need the function.

DateToString(StringToDate(OutDate.DATE,"%dd/%mm/%yyyy"),"%yyyy%mm%dd").

Please check the datatype of sv2. You might be assigning Date to a Integer datatype stage variable.


Thanks

Posted: Mon Jul 23, 2007 7:03 pm
by rafidwh
Did anyone faced this problem

Posted: Mon Jul 23, 2007 7:22 pm
by ArndW
phanee_k already pointed out your error. Check your datatype for sv2; it is an integer (or date) and you are assigning a string to it.

Posted: Mon Jul 23, 2007 7:27 pm
by rafidwh
its an integer data type

Posted: Mon Jul 23, 2007 7:35 pm
by rafidwh
I created a dummy job taking only Date field and converted the input date field from dd/mm/yyyy to yyyymmdd using the below function

DateToString(StringToDate(DSLink3.Date,"%dd/%mm/%yyyy"),"%yyyy%mm%dd")

Iam getting the same warning .Input field Datatype is Char(10) and output is Int(10).

I am trying using different target Datatype but couldn't suppress the warnings.

Posted: Mon Jul 23, 2007 8:35 pm
by ArndW
What is OutDate.DATE defined as and with what precision?

Posted: Mon Jul 23, 2007 8:39 pm
by rafidwh
Hi ArndW,

The outdate.Date is Char(10) and its output is int(8)

Posted: Mon Jul 23, 2007 8:41 pm
by rafidwh
out.Date is char(10) and output column is integer (8)

Posted: Tue Jul 24, 2007 1:12 am
by rafidwh
I get this warning after I validate the date

I am using a stage variable to validate the date
sv1:IsValid("DATE", StringToDate(DSLink3.Date,"%dd/%mm/%yyyy") )

In the output column the derivation is

If (sv1= @FALSE) Then "-1" Else DateToString(StringToDate(DSLink3.Date,"%dd/%mm/%yyyy"),"%yyyy%mm%dd")

If invalid then -1 else yyyymmdd format.

When I get an invalid date then I am getting the warning

Conversion error calling conversion routine date_from_string data may have been lost

Can anyone suggest me what is the error and how to supress the warnings

Posted: Tue Jul 24, 2007 4:21 am
by rafidwh
Hi Gurus,

Do you have any idea to suppress these warnings.
What might be the cause for it.

Posted: Tue Jul 24, 2007 10:45 am
by us1aslam1us
How are you handling the null values?