two type conversions in one derivation
Moderators: chulett, rschirm, roy
two type conversions in one derivation
Hi,
Iam trying to put something like below if then else condition in the derivation grid of my transformer.
If TRIM(DSLink219.COL5) = 'DATE' Then StringToDate(DSLink219.FIELD5,"%yyyy-%mm-%dd") Else StringToTimestamp(DSLink219.FIELD5,"%yyyy-%mm-%dd %hh:%nn:%ss")
I am getting the following compilation error, "Error in output column derivation expression for column FIELD5 in link DSLink232. Invalid conversion requested from a timestamp to a date."
I think it is not the proper way to two kinds of type conversions in one derivation but is there any other way of achieving the abvoce condition using one transformer.
Please advice
Iam trying to put something like below if then else condition in the derivation grid of my transformer.
If TRIM(DSLink219.COL5) = 'DATE' Then StringToDate(DSLink219.FIELD5,"%yyyy-%mm-%dd") Else StringToTimestamp(DSLink219.FIELD5,"%yyyy-%mm-%dd %hh:%nn:%ss")
I am getting the following compilation error, "Error in output column derivation expression for column FIELD5 in link DSLink232. Invalid conversion requested from a timestamp to a date."
I think it is not the proper way to two kinds of type conversions in one derivation but is there any other way of achieving the abvoce condition using one transformer.
Please advice
-
- Participant
- Posts: 117
- Joined: Wed Feb 06, 2013 9:24 am
- Location: Chennai,TN, India
What is the target data type?
Guess you are trying acheive this?
Guess you are trying acheive this?
Code: Select all
StringToTimestamp((If TRIM(DSLink219.COL5) = 'DATE' Then DSLink219.FIELD5 || "00:00:00" Else DSLink219.FIELD5),"%yyyy-%mm-%dd %hh:%nn:%ss")
Thanks,
Prasanna
Prasanna
-
- Premium Member
- Posts: 353
- Joined: Mon Jan 17, 2011 5:03 am
- Location: Mumbai, India
-
- Participant
- Posts: 18
- Joined: Tue Dec 25, 2012 10:39 pm
- Location: Detroit,MI
If, however, You are sending the conversion-result down to different targets with different datatypes, use two different columns for the derivation, even if the column-names happen to be identical in both targets (which is not a good practice, though).
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
There are the grateful those are happy." Francis Bacon
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 117
- Joined: Wed Feb 06, 2013 9:24 am
- Location: Chennai,TN, India