0

I have Number type field that has two decimal values. I am using the same value in my VF to generate quotations. If the value is 1.08 it is reflected 1.08 in VF, but if it is 1.00 then in VF it is reflected as 1.0 I need to display the value upto two decimal places. What should I do ? P.S for VF I am not using any class, just standard controller.

  • Please add the relevent VF code section so that it is easier to help you. – Dave Humm Oct 18 '16 at 7:43
2

You can use output text with apex:param-

<apex:page standardController="Opportunity">
    <apex:pageblock>
        <apex:pageblockSection>
            <apex:pageblockSectionItem>
                <apex:outputLabel value="{!$SObjectType.Opportunity.Fields.Amount.Label}"/>
                <apex:outputText value="{0, number, ###,###.00}">
                    <apex:param value="{!Opportunity.Amount}" />
                </apex:outputText>
            </apex:pageblockSectionItem>
        </apex:pageblockSection>
    </apex:param>
</apex:page>
|improve this answer|||||
  • <td align="right"><apex:outputText value="{0, number, ###,###.###}"> <apex:param value="{!Order.Tentative_Freight_Cost__c}" /> </apex:outputText></td> – Afroz Kazi Oct 18 '16 at 7:26
  • I used the above code, but if the value is 1.00 the decimal places are gone it displays only 1. Works if value of decimal other than 0. – Afroz Kazi Oct 18 '16 at 7:27
  • updated the example - {0, number, ###,###.00} – Raul Oct 18 '16 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.