convert to INT Tmap fails

Highlighted
Seven Stars

convert to INT Tmap fails

Hello,

 

I have an excel input file which has number types such as : 45,34 or 1916.

 

I have : tfileinput >>>>> tmap >>>>>> tfileoutput. So in the schema i put the column type "integer " in the input/tmap/output.

 

I want my output of this column in integer. Its all working good except for 1000+ number, they are not written. Why? 999,99 is working but 1111 is not. In the console I have this kind of error, in red : " For input string: "1,916"? But in my input I dont have any "," except for the decimal... Help?

Employee

Re: convert to INT Tmap fails

Hi,

 

    Could you please add a replace all function to remove all commas before passing to the tconverttype?

 

    Its working fine when the data is reaching in cleansed numerical format. Please see the screenshot below where input is string but output is integer.

image.png

 

 

Warm Regards,

 

Nikhil Thampi

Seven Stars

Re: convert to INT Tmap fails

Hello @nikhilthampi, thanks for your time !

 

Actually, I have to keep the comma ! Maybe I should explain myself better.

 

My input column looks like :

 Captureinput.PNG

And format is " number " on my excel sheet.

 

I want it in my input as number or integer what ever. But from now on, in my output I only have 334 & 78. I just tried "TconvertType" components but have the same error :  " For input string: "1,916" 

Forteen Stars

Re: convert to INT Tmap fails

@daez,since i suggest you to read  first that column as  string and remove that "," and the convert sting to integer.

 

row1.col.replace(',','')

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Employee

Re: convert to INT Tmap fails

@daez,

       

      Here you go! You can use below function to clear all the commas. Please refer both input and out in below screen shots and component details.

 

row1.input.replaceAll(",","")

image.pngJob flow

 

image.pngtMap replace

 

image.pngtConvertType

 

image.pngyConvertType schema

 

 

Could you please mark the topic as resolved since your query is answered? Kudos are also welcome :-)

 

Warm Regards,

 

Nikhil Thampi

Forteen Stars

Re: convert to INT Tmap fails

@daez,i sugget with @nikhilthampi replay,but you no need to use tConvertype,instead of that in same tmap you can convert form sting to integer.

 

Integer.parseInt(row1.Coll)

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Employee

Re: convert to INT Tmap fails

I agree with @manodwhb.

 

I added tConvertType to give a better graphical representation :-)

 

Warm Regards,

 

Nikhil Thampi

Forteen Stars

Re: convert to INT Tmap fails

@daez,still do you have this issue? 

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog