Skip to Content
0
Former Member
May 27, 2008 at 06:11 AM

Format decimal places

1017 Views

Post Author: Bandi

CA Forum: General

Using Crystal XI (v 11.0.0.2442)

Hopefully there is a simple obvious answer to this one... I need to have a numeric field set up so that it displays decimal places ONLY if the value is not an integer.

ie: I have 2 records with the values 24 and 24.945. I want these 2 values to display exactly like that....

Using only the formatting options for the field I can have them display as either 24.00 and 24.945 OR 24 and 25.

Just to complicate things, I set up a formula as follows... (Basic syntax shown... also tried crystal syntax)

if int() = then formula = ToText(, "#")else formula = ToText(, "#.####")end if

As far as I understand, this should have produced the results I wanted.... 24 and 24.945, however, it produces the results 24 and 24.95! WTF? Why is it rounding the second value to 2dp. This is a text formula so I dont have the ability to set any formatting which may have caused the problem.

Can anyone shed some light on this issue and show me the way forward?

Thanks, Anthony