One Star

Trouble concatenate a String + Date + Date

Hello,
I am trying to concatenate 3 input fields together. One is a string field and the other two are date fields.
My Input fields are as follows:
Selic Code = 100000
Issue Date = 20060804
Maturity Date = 20080401
Below is my expression in tMap:
("YMF")+("=")+(row2.Selic_Code)+("_")+(row2.Issue_Date)+("_")+(row2.Maturity_Date)+("=")
The Output Talend gives me is:
YMF=100000_Fri Aug 04 00:00:00 CDT 2006_Tue Apr 01 00:00:00 CDT 2008=
The Output I want to get is:
YMF=100000_20060804_20080401=
Can anyone help me correct this expression?
Thanks in advance,
David
5 REPLIES
One Star

Re: Trouble concatenate a String + Date + Date

what is the format of your fields Issue Date & Maturity Date? String or date?
One Star

Re: Trouble concatenate a String + Date + Date

Date, both have a Date Pattern of "yyyyMMdd"
One Star

Re: Trouble concatenate a String + Date + Date

try this in your tMap:
("YMF")+("=")+(row2.Selic_Code)+("_")+(TalendDate.formatDate("yyyyMMdd",row2.Issue_Date))+("_")+(TalendDate.formatDate("yyyyMMdd",row2.Maturity_Date))+("=")
One Star

Re: Trouble concatenate a String + Date + Date

Yes that worked, Thanks!
One Star

Re: Trouble concatenate a String + Date + Date

you'll welcome