DroidDB Tip of the Month
DroidDB® Tip for September 2017
Decimal Digits Displayed by a Calculated Control
When a calculated control is displaying a floating point number, it displays six decimal digits. If it is displayed as "Money", it displays two decimal digit. But what if you wanted to show one, three, four, or five decimal digits?
Say you have a column in your table called MyFloat whose datatype is Float. First, in the properties of the calculated control, set the display type to "Text". Then:
- To display one decimal digit, use the expression: @left(@round(MyFloat, 1),@length(@round(MyFloat, 1))-5)
- To display two decimal digits, use the expression: @left(@round(MyFloat, 2),@length(@round(MyFloat, 2))-4)
- To display three decimal digits, use the expression: @left(@round(MyFloat, 3),@length(@round(MyFloat, 3))-3)
- To display four decimal digits, use the expression: @left(@round(MyFloat, 4),@length(@round(MyFloat, 4))-2)
- To display five decimal digits, use the expression: @left(@round(MyFloat, 5),@length(@round(MyFloat, 5))-1)