One Star

field concatenation

hi
my input is look like
columnA columnB
2009 1
2009 2
2009 3
2009 4
2009 5
2009 6
2009 7
2009 8
2009 9
2009 10
2009 11
2009 12
i need out put like this
outcolumn
200901
200902
200903
200904
200905
200906
200907
200908
200909
200910
200911
200912
how can define by using components?

note:dont forgot about "0" after year.
i hope can help any one....
Thanking u.......
3 REPLIES
Community Manager

Re: field concatenation

Hello
Concatenate the two columns on tMap, eg:
row1.columnB.length()>1?row1.columnA+row1.columnB:row1.columnA+"0"+row1.columnB
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: field concatenation

HI.i ma getting error like this.can i know,how we can solve?
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method length() is undefined for the type Integer

Thanking u....
Community Manager

Re: field concatenation

Hello
The method length() is undefined for the type Integer

In my case, I assuming both the type of columnA and columnB are string. The method length() is for type string, you need convert Integer to string first.
String.valueOf(row1.columnB.length())>1?row1.columnA+row1.columnB:row1.columnA+"0"+row1.columnB

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business