Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
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?
Many thanks!
 TRF
		
			TRF
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 TRF
		
			TRF
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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) 
It works.
 
					
				
		
Alllllll day......... Thank you so much!!!!! That did it!
 TRF
		
			TRF
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 vapukov
		
			vapukov
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
it work
 Vijay_K_N
		
			Vijay_K_N
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		i dont know how much zeros i want to add ,if the account number length is 11 than i want to load otherwise i want to add zeros prefix the account number ??how to solve this
 
					
				
		
A quick solution is as shown below.
The function used is as shown below where 11 is the length of the output string. If its less than 11, zeros will be padded to the left.
String.format("%1$11s", row1.data).replace(' ', '0') 
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved
 Vijay_K_N
		
			Vijay_K_N
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		where is the talend.format option in tmap (string handling i am using talend 7.1)
@nthampi wrote:
A quick solution is as shown below.
The function used is as shown below where 11 is the length of the output string. If its less than 11, zeros will be padded to the left.
String.format("%1$11s", row1.data).replace(' ', '0')Warm Regards,
Nikhil ThampiPlease appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved
