Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Community,
I have used the below logic to convert String datatype to Float inside Expression Builder of tMap -
(row36.Spillover_km3 == null || row36.Spillover_km3.isEmpty() == true)?0 :Float.valueOf(row36.Spillover_km3)
but I'm getting the below error -
Exception in component tMap_13
java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1842)
at sun.misc.FloatingDecimal.parseFloat(FloatingDecimal.java:122)
at java.lang.Float.parseFloat(Float.java:451)
at java.lang.Float.valueOf(Float.java:416)
Can anyone please let me know how to rectify this issue?
For reference I have attached the job screenshot.
Thanks in advance!
Best Regards.
@dipanjan93, does this help?
If so, thanks to mark your case as solved (Kudos also accepted as a bonus)
can you try the below one.
(row36.Spillover_km3 == null || ("").equals(row36.Spillover_km3))?0 :Float.valueOf(row36.Spillover_km3)
What about this one:
(row36.Spillover_km3 == null ||
("").equals(row36.Spillover_km3.replaceAll(" ", ""))) ? 0.0f : Float.valueOf(row36.Spillover_km3)
@dipanjan93,since you might have space issue use the below way.i have tested below one working as expected.
(row1.Col == null || ("").equals(StringHandling.TRIM(row1.Col)))?0 :Float.valueOf(row1.Col)
Hi @TRF
Nope still the issue persists. Although now something new has come up -
java.lang.NumberFormatException: For input string: "null"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseFloat(FloatingDecimal.java:122)
at java.lang.Float.parseFloat(Float.java:451)
at java.lang.Float.valueOf(Float.java:416)
@dipanjan93, does this help?
If so, thanks to mark your case as solved (Kudos also accepted as a bonus)