Show always two decimals

Dominik9
Tera Guru

Hi experts

How can we display fields from type decimals always with two decimals? E.g. "100.00" instead of just "100"? Is it possible to ensure the numbers are always displayed with two decimal places?

Do we need to change the field type to achieve this? One potential solution could be to use the "Currency" field type. But we wouldn't need the currency code. However, is it possible to display the currency code of the currency field as read-only and set the code just once for all currency fields on the record based on a choice field? Or even better to not display the currency code?

 

What do you think would be the way to go to achieve this? 

 

Thanks

Dominik

7 REPLIES 7

jcmings
Mega Sage

You can create a column of type Decimal. You could also do type String and use the .toFixed(2) function to get two decimal places.

Hi jc21

 

Thank you for your response.  

 

Using type Decimal is cutting the decimals always. E.g. if 100.00 is saved. It is saved in the database and displayed on the form as 100. 

The problem of using String is that it will be left aligned and therefore will not be a clear presentation in list view. But presentation and clarity are the reason we would like to always have two decimals. 

 

Best regards

Dominik

It looks like people have had varying success with changing the scale attribute, but it's worth a shot. You can find more information on that here. Otherwise, I think you might be out of luck😐.

Unfortunately, scale does also cut decimals like e.g. 100.00 to 100. So, I am out of luck :-). But thank you anyways for your effort.