Optional decimal precision float

Hi, My customer would like to see at max 3 decimal positions when I use a float AND when no decimals are inserted, no decimal positions at all. Examples: Input: 12,38414 Output: 12,384 Input: 12.000 Output: 12 Is this construction possible in Mendix 4.4.4 dataviews en datagrids? Kind regards, Rolf
1 answers


It is not possible to display a float as you mention. Setting the decimal precision will show the amount of decimals indicated whether they a 0 or not. If you need this to be displayed as mentioned you'll need a custom widget in a dataview. For the grid you could set the float value in a string field and have a function that removes all the 0-chars and the decimal point if all decimals are 0.