Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
sushantk19
Creator
Creator

rounding correction

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.

Labels (2)
5 Replies
sushantk19
Creator
Creator
Author

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? 

manodwhb
Champion II
Champion II

@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;

 

 

0683p000009MaOp.png

0683p000009MaNx.png

sushantk19
Creator
Creator
Author

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?

manodwhb
Champion II
Champion II

@sushantk19,its double.