Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
daez
Creator
Creator

Data Handling using TMAP

Hello dear community,

I'm trying to modify data using TMAP but i have no idea how to use a IF/COUNT condition.

Input column : >>>>> Output needed :

112345 >>>>> 0000112345

11240 >>>>> 0000011240

110247 >>>>> 0000110247

142 >>>>> 0000000142

I need it to count the char and fill it with 0 or blank until it reach a given count, like 10 for this example.

Any help appreciated !

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi

Try this expression on tMap.

String.format("%010d", row1.columnName)

 

Regards

Shong

View solution in original post

4 Replies
Anonymous
Not applicable

Hi

Try this expression on tMap.

String.format("%010d", row1.columnName)

 

Regards

Shong

daez
Creator
Creator
Author

Hello shong,

 

Thanks for the help !

 

This is what im getting : 0693p00000AGYiWAAX.png 

 

Data type is String only on TALEND. The excel im getting data from isnt in integer.

My data we talking about looks like :

 

20190-002

MA01547

 

I tried adding String.valueOf() but having exact same error again :

 

String.format("%010d",String.valueOf(row1.newColumn1))

 

 

Thanks for your knowledge

 

 

Anonymous
Not applicable

If your data is a string, try this

org.apache.commons.lang.StringUtils.leftPad(row1.columnName, 10, "0")

 

 

daez
Creator
Creator
Author

Hello @Shicong Hong​ ,

 

I got an error using ur last idea. Might be from a JAR files missing. I find my hapiness with StringHandling.LPAD(row1.lotfourni, 20, " ")

 

THANKS.