Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
daez
Creator
Creator

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?

Labels (2)
7 Replies
Anonymous
Not applicable

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.

0683p000009M1HV.png

 

 

Warm Regards,

 

Nikhil Thampi

daez
Creator
Creator
Author

Hello @nthampi, thanks for your time !

 

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

 

My input column looks like :

 0683p000009M1Cb.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" 

manodwhb
Champion II
Champion II

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

 

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

Anonymous
Not applicable

@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(",","")

0683p000009M13A.pngJob flow

 

0683p000009M1Hp.pngtMap replace

 

0683p000009M1Hz.pngtConvertType

 

0683p000009M1IE.pngyConvertType schema

 

 

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

 

Warm Regards,

 

Nikhil Thampi

manodwhb
Champion II
Champion II

@daez,i sugget with @nthampi 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)

Anonymous
Not applicable

I agree with @manodwhb.

 

I added tConvertType to give a better graphical representation 🙂

 

Warm Regards,

 

Nikhil Thampi

manodwhb
Champion II
Champion II

@daez,still do you have this issue?