Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am using tmap to read data from a file and load it into a table.
One of the columns in the text file contains values like:
0.05
0.03
etc...
However when Talend flow uploads the data into the table the values change from 0.05 to 0.05000000075
or from 0.03 to 0.03999999911.
I have tried two approached in the tmap to try to reduce the value to two decimal places so I get only values like 0.05 or 0.03:
(row6.MinIncrease == null || row6.MinIncrease.equals("")) ? 0f :
row6.MinIncrease.floatValue()
(row6.MinIncrease == null || row6.MinIncrease.equals("")) ? 0f :
Math.round(row6.MinIncrease*100)/100f
but no luck. still getting values like 0.05000000075 .
What can I do here so I get only two decimal places?
thanks
I have turned on log4j and it prints each row of the data with correct values. Have a look at the last field below:
2D072|753|2536.1667|0.0|
06052|401|1801.1893|0.05|
Also tried using BigDecimal. I could get the flow to execute with BigDecimal data type.
I have got it to work. I modified the data type in the tmap to Double for both source and destination. Even though the column data type in Snowflake is float.
Appreciate your help and support.
Thanks
it will not work, even if you change at schema level