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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
slim1501
Contributor II
Contributor II

[resolved] Error in a Tmap : java.lang.NumberFormatException: For input string

Hello,
I have a job that allows you to extract data from Excel and SQL Table to store in a SQL server database.
I did the transformation fields String float.
But I do not understand why I have this error:


Exception in component tMap_2
java.lang.NumberFormatException: For input string: "0,0506609517898527"
Has sun.misc.FloatingDecimal.readJavaFormatString (Unknown Source)
Has java.lang.Float.parseFloat (Unknown Source)
Has bdd_budget_icp.bud_0_1.Bud.tFileInputDelimited_1Process (Bud.java:2332)
Has bdd_budget_icp.bud_0_1.Bud.runJobInTOS (Bud.java:4470)
Has bdd_budget_icp.bud_0_1.Bud.main (Bud.java:4291)
disconnected


Please find enclosed my tmap and my Job.
What is the problem please? and how to solve it?
Regards
Labels (4)
20 Replies
Anonymous
Not applicable

what coma denotes in all the fields? is it a thousand separator or  a decimal point? 
slim1501
Contributor II
Contributor II
Author

It's a decimal point
Anonymous
Not applicable

then below statement should work, use below statement for all the columns which has numeric data and you want to convert it to big decimal. 
new BigDecimal(row1.tx_rfa.replace(",","."))
slim1501
Contributor II
Contributor II
Author

I'll try,
But,Typing my database should I leave it as it is?

CREATE TABLE BUDGET_CA
(CURRENT_FILE varchar (255) NOT NULL PRIMARY KEY,
Date_Bud Date,
code_CLI varchar (255),
NAT_CODE varchar (255),
code_article varchar (255),
ACTION_BUD2014 varchar (255),
Zone_Geo varchar (255),
Tx_RFA DECIMAL (19,5)
CST_PROD_KG DECIMAL (19,5)
CST_LOG_KG DECIMAL (19,5)
Kilo_BU DECIMAL (19,5)
CA_BUD DECIMAL (19,5)
CMA_BUD DECIMAL (19,5)
Cpt_Comptbl_F varchar (255),
Code_Analytiques varchar (255)
);

Thank you for your help.
slim1501
Contributor II
Contributor II
Author

I tried it, it did not work, I got this error:

Exception in component tMap_2
java.lang.NumberFormatException
Has java.math.BigDecimal. <init> (Unknown Source)
Has java.math.BigDecimal. <init> (Unknown Source)
Has bdd_budget_icp.bud_0_1.Bud.tFileInputDelimited_1Process (Bud.java:2296)
Has bdd_budget_icp.bud_0_1.Bud.runJobInTOS (Bud.java:4089)
Has bdd_budget_icp.bud_0_1.Bud.main (Bud.java:3910)


I do not understand why it does not work !!!!!
Anonymous
Not applicable

can you show me your input component schema and tmap output schema. 
slim1501
Contributor II
Contributor II
Author

The problem was the comma. I resolved; in each column that I want to convert I do this:

fromMainFlow.Tx_RFA! = null && fromMainFlow.Tx_RFA.trim ().length ()> 0? 
BigDecimal.valueOf (Double.valueOf (fromMainFlow.Tx_RFA.replaceAll (",", "."))): null

Thank you all for your help.
See you soon.
have a nice day
Anonymous
Not applicable

Hi ,

 

While trying and loading the data in output database, i am getting below error:

 

Couldn't parse value for column 'CID' in 'row1', value is '"5"'. Details: java.lang.NumberFormatException: For input string: ""5""
Couldn't parse value for column 'CID' in 'row1', value is '"48"'. Details: java.lang.NumberFormatException: For input string: ""48""

PFA screenshots of tMap 

Please suggest the needful


tMap_Screenshot.png
Anonymous
Not applicable

Please reply me ..its urgent
Anonymous
Not applicable

Hello,

You are inserting the value "CID" from row1in to the field having data type as integer and it should not consist of character value, like "".

Best regards

Sabrina