Concatenation in transformer ?
Moderators: chulett, rschirm, roy
Concatenation in transformer ?
Hi,
I want to concatenate '01' to a decimal value in a transformer stage. I tried it using stage variables but I didn't get exact result. Can you suggest me a way to achieve this?
Source data is like 201001, 201103, 200905 (6 digits, Integer/Decimal format)
Target should be like 20100101, 20110301, 20090501 (8 digits, Integer/Decimal format).
Thanks,
I want to concatenate '01' to a decimal value in a transformer stage. I tried it using stage variables but I didn't get exact result. Can you suggest me a way to achieve this?
Source data is like 201001, 201103, 200905 (6 digits, Integer/Decimal format)
Target should be like 20100101, 20110301, 20090501 (8 digits, Integer/Decimal format).
Thanks,
Bhanu
-
- Participant
- Posts: 342
- Joined: Tue Nov 04, 2008 10:38 am
- Location: Chennai, India
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Concatenate is a string operator.
If applied to a Date data type then an implicit conversion to String is performed.
There is no implicit conversion for going the other way (string to date) so you have to specify an explicit data type conversion function such as StringToDate().
If applied to a Date data type then an implicit conversion to String is performed.
There is no implicit conversion for going the other way (string to date) so you have to specify an explicit data type conversion function such as StringToDate().
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett wrote:If you want to pursue the first method, show us the syntax you used and we'll go from there. ...
Stage:
DSLink2.KEY:'01' --- DATE (varchar)
StringToDecimal(DATE) --- Output (decimal)
Output:
Output --- Date_output (decimal)
But I am getting output same as input.
So, I modified logic like this
Stage:
DSLink2.KEY:CONC --- DATE (varchar)
StringToDecimal(DATE) --- Output (decimal)
01 ---- CONC (varchar)
Output:
Output --- Date_output (decimal)
Even I am getting output same as input I didn't understand really why it is happening like that.
Bhanu