Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Im trying to convert this bigdecimal "456456456456456" to double using this expression in tmap
row1.amount!=null?row1.amount.doubleValue():0 . I get 4.56456456456456E14 as the result . what should i do convert as it is to 456456456456456 .
If you are writing to a file, change your column to a String and use this code to convert it....
row1.amount!=null?row1.amount.toPlainString():"0"
The numbers are the same. It is just represented using scientific notation. Are you printing this out? Do you need this printed without the scientific notation?
Rhall,
When i output in file using tfileoutputdelmited , i get the exponential value . i need it in the same format without exponential .
Im not sure how to do that . Can you help me
If you are writing to a file, change your column to a String and use this code to convert it....
row1.amount!=null?row1.amount.toPlainString():"0"
Thanks rhall , Is there any way after reading the file we could chenage that type of the field to bigdecimal or double ?
If you are reading a flat file ALL fields are essentially Strings. The Talend components will use the schema you create to convert on reading the data
But what if I dont want to change the data type of the field to string. Is there any other alternative for this?
If you are writing to a flat file, the conversion of your column data is implicitly converted to a String. Flat file data is a String. If you are loading to a target which is able to comprehend different data types, then the formatting of those types will be configured within the target.