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

converting String to Integer error - tmap

Hi,
I am stuck with this error and unable to figure out what's wrong the expression, I am converting a string value to integer based on the condition, below is the expression I have added in the tMap
(StringHandling.TRIM(Source.SR_Current_SA_Number.toString()) == "Not Available")?Integer.parseInt("0".toString()):Integer.parseInt(StringHandling.TRIM(Source.SR_Current_SA_Number.toString()))

Error exception :
Exception in component tMap_1
java.lang.NumberFormatException: For input string: "Not Available"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.valueOf(Integer.java:554)
at nexus.import_closed_cases_0_1.Import_Closed_Cases.tOracleInput_1Process(Import_Closed_Cases.java:2379)
at nexus.import_closed_cases_0_1.Import_Closed_Cases.runJobInTOS(Import_Closed_Cases.java:3076)
at nexus.import_closed_cases_0_1.Import_Closed_Cases.main(Import_Closed_Cases.java:2947)
-------
Any help wil be much appreciated.
Thanks,
Naran
Labels (3)
1 Reply
Anonymous
Not applicable
Author

Hi
In Java, to determine whether two strings are equal should use string1.equals("string2"), try this expression:
(StringHandling.TRIM(Source.SR_Current_SA_Number.toString()) .equals("Not Available"))?Integer.parseInt("0".toString()):Integer.parseInt(StringHandling.TRIM(Source.SR_Current_SA_Number.toString()))
Best regards
Shong