Normally, calculated controls display 6 digits to the right of the decimal point. If you turn on the "Money" property, it is rounded to 2 decimal places. But say you wanted to display 1, 3, 4, or 5 decimal places for a floating point value. You can do this by using the following expressions (assuming the floating point value is stored in variable 88): - 1 decimal place: @left(@round(@var(88),1), @length(@var(88))-5)
- 2 decimal places: (use Money datatype)
- 3 decimal places: @left(@round(@var(88),3), @length(@var(88))-3)
- 4 decimal places: @left(@round(@var(88),4), @length(@var(88))-2)
- 5 decimal places: @left(@round(@var(88),5), @length(@var(88))-1)
- 6 decimal places: (default for Float datatype)
Thanks to Scott Denton of Denton Software Solutions, Inc. for this month's tip. (also see the August 2001 tip of the month) |