Find your content:

Search form

You are here

How to display Currency field with all the decimal places without rounding it?

 
Share

I want to display the currency field with all the decimal places.Right now salesforce automatically rounds it to two decimal places. salesforce displays 123.45678 as 123.46 ,i want it to be 123.45678 on the detail page,it displays as 123.45678 on edit page.Is there any way to do it?!

enter image description here


Attribution to: Keepcalmncode

Possible Suggestion/Solution #1

enter image description here

enter image description here

You can specify the decimal values for the field as shown in above screenshot


Attribution to: Mohith Shrivastava

Possible Suggestion/Solution #2

Take a look at the docs on apex:outputText. You can use the Java MessageFormat format strings.

For example, the following will display US currency with six decimal places, formatted with comma separators, up to 999 trillion dollars and will always show six digits to the right of the decimal place due to the zeroes. This is Visualforce, though.

<apex:outputText value="{0, number, $###,###,###,###,##0.000000}">
    <apex:param value="{!myObject.My_Value__c}"/>
</apex:outputText>

Attribution to: Peter Knolle

Possible Suggestion/Solution #3

Currency fields are formatted according to the record's currency (ISO code) and the org currency setup (Company Profile - Manage Currencies).

You have several options:

  1. Change the number of decimal places for the currency as a whole (perhaps unlikely that this will be what you want - as this will change the formatting of all currency values everywhere for that currency)

  2. Change the type of your field from "currency" to "number"

  3. Add a formula field where the output type is number and is set to 6dp, where the formula simply references your existing currency field


Attribution to: Stephen Willcock

Possible Suggestion/Solution #4

I have modified the currency settings under the manage currencies section.


Attribution to: Keepcalmncode
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/3658

My Block Status

My Block Content