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 HummOct 18, 2016 at 7:43
1 Answer
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>
-
<td align="right"><apex:outputText value="{0, number, ###,###.###}"> <apex:param value="{!Order.Tentative_Freight_Cost__c}" /> </apex:outputText></td> Oct 18, 2016 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. Oct 18, 2016 at 7:27
-