Hi, all
I need to obtain a double value which has no exponent in an csv file. The file is from a tfileOutputdelimited. In my files I got these things : 1.0137901051E8 and I need 101379010.51.
I've checked previous posts for samiliar question and found one link as below:
https://community.talend.com/t5/Design-and-Development/resolved-Suppress-Exponent-in-a-double-format... However I'm not totally understand how to apply above solution, can we manually change the codes?
Thanks!
Hi, I append below codes into a tJavaRow component:
java.text.DecimalFormat df = new java.text.DecimalFormat("#.##");
output_row.TDCash = df.format(input_row.TDCash);
output_row.SDCash = df.format(input_row.SDCash);
output_row.Adjust = df.format(input_row.Adjust);
However when running, I got below errors:
Exception in component tJavaRow_1
java.lang.IllegalArgumentException: Cannot format given Object as a Number
at java.text.DecimalFormat.format(Unknown Source)
at java.text.Format.format(Unknown Source)
at talenddemosjava.poms_cash_adjust_0_1.POMS_Cash_Adjust.tFileInputDelimited_1Process(POMS_Cash_Adjust.java:2392)
at talenddemosjava.poms_cash_adjust_0_1.POMS_Cash_Adjust.runJobInTOS(POMS_Cash_Adjust.java:3917)
at talenddemosjava.poms_cash_adjust_0_1.POMS_Cash_Adjust.main(POMS_Cash_Adjust.java:3785)
It seems java met a type mismatch error. Can u help to have a look?
I found the problem. It's also a NULL pointer problem. After I made changes as below, the problem is resolved: if (input_row.Adjust != null) {output_row.Adjust = df.format(input_row.Adjust);} Thanks!