I am having issues with data been shown in scientific notation, I am reading in data from a SQL Server database, the field in question is as follows
Round(lunt.AverageNetRent*ua.Area,0)
the field is defined as a bigDecimal in Talend on the input schema.
Then I use tConvertType to convert to a String before I map it and write out to a CSV. The funny thing is that if there a value it displays correctly only when the calculation is 0 does it switch to scientific notation. Any ideas? Here is the data, 3 rows, first two have the issue in the first column (0E-8), the third row is displays a value of (64562.00000000)
jlolling, can you explain when you say the value maybe not be exactly zero, what you mean.
.
So I ran a simple test, where I use the following select statement
As you can see from the results below it looks like any field with a scale of more than 6 with 0 results in scientific notation representation when you convert to string.
If you have data it does not use scientific notation? see second result set below.
Can anyone confirm that this is expected behavior for Talend or Java?
And can anyone comeup with away around this?
ok. I wish I was more proficient in Java, then it won't take so long to find a solution. :-), maybe a 2014 goal.
.
Found a method that I believe I need to use when converting a bid decimal to string. The method that needs to be applied is
BigDecimal toPlainString() method
In general, Java BigDecimal value scale and rounding mode can be set by setScale(scale, roundingMode) during a BigDecimal operation. To display a BigDecimal value, user can use either the toString() or toPlainString() methods. The toString() method may use scientific notation while toPlainString() never will.