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

Seven Stars

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)

                    at org.talend.designer.runprocess.DefaultRunProcessService.checkLastGenerationHasCompilationError(DefaultRunProcessService.java:380)

                    at org.talend.designer.runprocess.RunProcessService.checkLastGenerationHasCompilationError(RunProcessService.java:292)

                    at org.talend.designer.runprocess.ProcessorUtilities.generateBuildInfo(ProcessorUtilities.java:656)

                    at org.talend.designer.runprocess.ProcessorUtilities.generateCode(ProcessorUtilities.java:545)

                    at org.talend.designer.runprocess.ProcessorUtilities.generateCode(ProcessorUtilities.java:1506)

                    at org.talend.designer.runprocess.RunProcessContext$1.run(RunProcessContext.java:577)

                    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:466)

                    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:374)

                    at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:527)

                    at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:284)

                    at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1190)

                    at org.talend.designer.runprocess.RunProcessContext.exec(RunProcessContext.java:532)

                    at org.talend.designer.runprocess.ui.ProcessComposite.exec(ProcessComposite.java:1450)

                    at org.talend.designer.runprocess.ui.views.ProcessView$RunAction.run(ProcessView.java:691)

                    at org.talend.designer.runprocess.ui.actions.RunProcessAction.run(RunProcessAction.java:58)

                    at org.talend.designer.core.debug.JobLaunchConfigurationDelegate$1.run(JobLaunchConfigurationDelegate.java:84)

                    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)

                    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)

                    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)

                    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)

                    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)

                    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

                    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)

                    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)

                    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)

                    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

                    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)

                    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)

                    at org.talend.rcp.intro.Application.start(Application.java:255)

                    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)

                    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)

                    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)

                    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)

                    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                    at java.lang.reflect.Method.invoke(Unknown Source)

                    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)

                    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)

                    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)

 

Thank you for your answers in advance

Forteen Stars

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

@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)

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

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

@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...?

Forteen Stars

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

@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/

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

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

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.

Seven Stars

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

@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

 

 

Highlighted
Seven Stars

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

@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....

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

Downloads and Trials

Test drive Talend's enterprise products.

Downloads