I'm using CR XI Prof and hit a strange issue converting a string field to a number so I could calculate an average.
The string field "Lab.Value" has one or two characters (always digits), a decimal, and another character/digit - e.g., 7.3 or 10.8. Using both ToNumber and CDbl, the result rounded the value to no decimal places - 7.0 and 11.0. I made sure that formatting wasn't the problem - I could display any number of decimal places but it still gave me that whole number followed by however many 0's. Because I was in a hurry I got around the issue by converting the string to currency and then in a second formula converting the currency to number, and everything appeared to work out fine.
But why is this happening, and how can I prevent it in the future? Thanks so much for y'all's help.
Laura
The string field "Lab.Value" has one or two characters (always digits), a decimal, and another character/digit - e.g., 7.3 or 10.8. Using both ToNumber and CDbl, the result rounded the value to no decimal places - 7.0 and 11.0. I made sure that formatting wasn't the problem - I could display any number of decimal places but it still gave me that whole number followed by however many 0's. Because I was in a hurry I got around the issue by converting the string to currency and then in a second formula converting the currency to number, and everything appeared to work out fine.
But why is this happening, and how can I prevent it in the future? Thanks so much for y'all's help.
Laura