function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ram123ram123 

Currency Formating VF Tag & Apex Decimal method

1. VF Tag Currency Formating - I'm using the following to format my currency, it works mostly fine, but in case of 0 values, it shows .00 instead of 0.00 - any suggestion ?

 

<apex:outputText value="{0,number, #,###,###.00}" >
<apex:param value="{!item.totalCost}" />
</apex:outputText>

 

 

2. Also curious, Decimal.SetScale(2, RoundingMode) rounds properly in controller , and I checked in view state, but when I show it in VF page, its chopping the last 0  for certain cases, ex:, 60.00 to 60.0 , anybody noticed this issue ?

 

Thanks

Ram

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Cory CowgillCory Cowgill

Try <apex:outputText value="{0,number, #,###,##0.00}" >

All Answers

Cory CowgillCory Cowgill

Try <apex:outputText value="{0,number, #,###,##0.00}" >

This was selected as the best answer
ram123ram123

Thanks Cory, it works. Just curious any reason why the controller rounding is dropped in VF page ?

 

Ram