You need to sign in to do that
Don't have an account?

Thousand's separator ..
Folks,
I have a decimal which I need to display with thousands separator on a visualforce page. An outputText displays that value.
E.g: now it is 5360. I wanted it to be displayed as : 5,360
Any suggestions or ideas on how can I convert the decimal to the currency format ?? unforunately, I cannot use the exact sObject field as I am using a wrapper class.
Thanks folks.
Even when you are using a wrapper class you can still leverage a proxy instance of an sobject (any sobject type that has a currency field will work - although you might need to use a custom field for this to get the formating you want) in your wrapper class that you push the value you want to display using an apex:outputField into. For example (you'll have to adapt this to your wrapper class of course):
<apex:page controller="CurrencyProxyDemoController"> <apex:outputField value="{!proxy.annualRevenue}"/> </apex:page> public class CurrencyProxyDemoController { public Account getProxy() { proxy.annualRevenue = 123456.78; return proxy; } private final Account proxy = new Account(); }
All Answers
Try this :
<apex:page controller="testdecimalController"> <apex:outputText value="{!testdecimalformatted}"></apex:outputText> </apex:page> public class testdecimalController { public Decimal testdecimal {get;set;} public testdecimalController() { this.testdecimal = 10000000000.00; } //getter method for a formatted version for display public String getTestdecimalformatted() { return testdecimal.format(); } }
Even when you are using a wrapper class you can still leverage a proxy instance of an sobject (any sobject type that has a currency field will work - although you might need to use a custom field for this to get the formating you want) in your wrapper class that you push the value you want to display using an apex:outputField into. For example (you'll have to adapt this to your wrapper class of course):
<apex:page controller="CurrencyProxyDemoController"> <apex:outputField value="{!proxy.annualRevenue}"/> </apex:page> public class CurrencyProxyDemoController { public Account getProxy() { proxy.annualRevenue = 123456.78; return proxy; } private final Account proxy = new Account(); }
Thanks for your response Doug. Yes I think I would need to have a custom field to define my own formatting.
Thanks again.