I have been wrestling with this all day. StringHandling.LPAD(row2.SAP_ID, 6, "0") tests without error in the Expression Builder however isn't inserting the leading 0's in my field. Any suggestions?
Pad methods are unavailable from TOS 6.4.1, so I can't try but you can do what you want with:
StringHandling.RIGHT("000000" + row2.code, 6)
other solution - is add to project routines library StringUtils from Exchange (plus dependencies - Apache common-lang-2.6)
it include many useful function and handle null values more proper than some Talend functions
* StringUtils.leftPad(null, *, *) = null * StringUtils.leftPad("", 3, 'z') = "zzz" * StringUtils.leftPad("bat", 3, 'z') = "bat" * StringUtils.leftPad("bat", 5, 'z') = "zzbat" * StringUtils.leftPad("bat", 1, 'z') = "bat" * StringUtils.leftPad("bat", -1, 'z') = "bat"
and use it in tMap
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Watch the recorded webinar!
Pick up some tips and tricks with Context Variables
Learn how media organizations have achieved success with Data Integration
Introduction to Talend Open Studio for Data Integration.