Crystalyzer
Technical User
- Mar 28, 2003
- 218
Hi all,
I want to control the number of decimals displayed in my number format. If there are 3 decimals I want to dispay the number as "1.234" and if there are 0 decimals I want to display it as "1". I want this for up to 5 decimal places.
I have entered the following formula in the custom style decimal format formula box and the default format is set to 5 decimals and rounded to 5 places.
The source data is a field that is formated to 5 decimal places regardless of the actual number of decimals (ex 1.23 = 1.23000). The problem is that my formula doesn't work for some reason. I get results that are not in line with what I would expect. Some fields display 2 decimals sometimes and others display 5.
Can anyone help me?
Thanks!
I want to control the number of decimals displayed in my number format. If there are 3 decimals I want to dispay the number as "1.234" and if there are 0 decimals I want to display it as "1". I want this for up to 5 decimal places.
I have entered the following formula in the custom style decimal format formula box and the default format is set to 5 decimals and rounded to 5 places.
Code:
If Truncate(CurrentFieldValue)- ROUND(CurrentFieldValue,6) = 0 then 0 Else
If Truncate(CurrentFieldValue,1)- ROUND(CurrentFieldValue,6) = 0 then 1 Else
If Truncate(CurrentFieldValue,2)- ROUND(CurrentFieldValue,6) = 0 then 2 Else
If Truncate(CurrentFieldValue,3)- ROUND(CurrentFieldValue,6) = 0 then 3 Else
If Truncate(CurrentFieldValue,4)- ROUND(CurrentFieldValue,6) = 0 then 4 Else DefaultAttribute
The source data is a field that is formated to 5 decimal places regardless of the actual number of decimals (ex 1.23 = 1.23000). The problem is that my formula doesn't work for some reason. I get results that are not in line with what I would expect. Some fields display 2 decimals sometimes and others display 5.
Can anyone help me?
Thanks!