Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have to round data from 4 decimal places to 2 in tmap. which function can i use?
like if my value is 49.2750 then o/p should be 49.28. Presently i am getting it as 49.27 as my output is decimal 2 places.
@sushantk19 ,have you verified the below link?
https://community.talend.com/t5/Design-and-Development/Tmap-Float-variable-needs-to-Round/td-p/30301
Yes, but my scenario is a little different. I have to sum up 3 decimal values i.e A+B+C and then round upto 2 decimal places. is there a function in tmap to do that like we have ROUND function in redshift db.
I tried this, but it is rounding to nearest integer, but i want upto 2 decimal places.
Math.round(yourValueHere * 100.0)/100.0
Also, i am not very good in writing any routine or java. Can you suggest if we have any function in Tmap?
@sushantk19 ,check the below is working for me. and data type of the column is double.
Input: 49.2750
output: 49.28
output_row.newColumn = Math.round(input_row.newColumn* 100.0)/100.0;
what is the datatype of this field in tjavarow component? it is not allowing me to keep it as float 8,2? should i make it double?
@sushantk19,its double.