Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

not able to use "integer.parseInt" in the component tMap

Hello

 

I am a French beginner in Talend and java but i learn a lot. Sorry for my english.

I want to use "interger.parseInt" in the component tMap (output).

But i have errors with configuration of Java, i think.

For information : 

I hava Talend Data Integration : version 6.5.1

installed JRE : jre1.8.0_161

 

I don't understand why it doesn't work.

 

Type mismatch: cannot convert from int to String

Il peut y avoir d'autres erreurs causées par la compatibilité avec la JVM. Vérifiez que les paramètres de votre JVM sont les mêmes que dans le studio.

                    at org.talend.designer.runprocess.JobErrorsChecker.checkLastGenerationHasCompilationError(JobErrorsChecker.java:328)



To see the whole post, download it here
Labels (5)
6 Replies
manodwhb
Champion II
Champion II

@Beauchamp_J,since you are converting int to sting right based on given error? you should use below way.

 

row1.field.toString() or Sting.valueOf(row1.field)

Anonymous
Not applicable
Author

@manodwhb

 

I want to convert string to integer because in the Excel, there are values which are in string.

column : A

Row : Title

Row 2 : Sub-Title 

Row 3 : 145.157 

Row 4 : 475,757 (in Excel : =444+42)

row 5 : 24%

...

 

I want that row 3, 4, 5 convert from string to int

 So i wrote "Integer.parseInt(row1.A)"

I don't know if i am clear...?

manodwhb
Champion II
Champion II

@Beauchamp_J,for "145.157" kind of data you need to use Float converion as below expression.

Float.parseFloat("145.157").

 

for "475,757" first you need to remove ,from the data and should apply int or bigdecimal conversion

 

for "24%",first remove % characted and aplly Integer.parseInt("24")

 

please find the below link to know the data types in Talend.

https://talendweb.wordpress.com/2017/04/26/talend-data-types/

cterenzi
Specialist
Specialist

Type mismatch: cannot convert from int to String

 

My first instinct when seeing this error message is to check the schema in my tMap, making sure that the data types align with the inputs and expressions.  Make sure that the column containing the parseInt expression is defined as int/Integer in the output schema.

Anonymous
Not applicable
Author

@manodwhb

Thank you for your answer.

 

My matter is : I can't make Float.parseFloat("145.157").

There are many columns and lines.

I can't put it in the editor of tMap (Expression).

Float.parseFloat(row1.A."line4") 

I think that it isn't right

 

 

Anonymous
Not applicable
Author

@cterenzi

I have already made that.
Exception in component tMap_1 (Test_Dashbroad_Tri_Donnees_ExternalRevenus)
java.lang.NumberFormatException: For input string: " October 17"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)

In the column : there are :
Month | October
Money | 12578
MoneyPer Month | 125.7
MoneyPerYear | 6585,75 (in Excel : =564+412) (for example! )
Percentage | 22% (in output, i see 0,22 on Excel and I don't how multiply per 100....)

So There are String AND Integer  in a same column. It is why it is difficult for me, a little begginer....