convert to INT Tmap fails

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


Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for spending their time for your query. If your query is answered, please mark the topic as resolved :-)
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" 

Thirteen 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
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


Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for spending their time for your query. If your query is answered, please mark the topic as resolved :-)
Highlighted
Thirteen 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
Employee

Re: convert to INT Tmap fails

I agree with @manodwhb.

 

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

 

Warm Regards,

 

Nikhil Thampi


Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for spending their time for your query. If your query is answered, please mark the topic as resolved :-)
Thirteen Stars

Re: convert to INT Tmap fails

@daez,still do you have this issue? 

Manohar B

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.