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
Request clarification before answering.
Post Author: Bandi
CA Forum: General
Thanks for the suggestion. Unfortunatly it didn't resolve the formatting issue I'm having.
formula = ToText(, "#.####", 3) produces the result 24.9450 where I only want to see 24.945. For the number 24.9, it produces 24.9000 -
2) Specifying a formula as formula = ToText(, "#.####", 10) where Myfield is a decimal value with 1, 2 or 3 decimal places returns the value padded with trailing 0's out to 4 decimal places (ie: 24.9 becomes 24.9000) even though the # should mean that that position is left empty if no decimals exist in that position.
Thanks heaps Anthony
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post Author: SKodidine
CA Forum: General
Try:
formula = ToText(), "#.####", 3),
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post Author: Bandi
CA Forum: General
P.S.
If I change the last formula line to
formula = ToText(), "#.####", 10), it produces 24.9450. It now gets the number correct, but ignores the fact I'm using a # for the formatting and puts a trailing 0 in. * SIGH*
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 10 | |
| 5 | |
| 5 | |
| 5 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.