+ Start a Discussion
SamuelDeRyckeSamuelDeRycke 

Formatting with apex:outputText

I know we can format with the apex:outputText component, and the documentation refers to some java documentation:

 

"Use with nested param tags to format the text values, where {n} corresponds to the n-th nested param tag. The value attribute supports the same syntax as the MessageFormat class in Java. See the MessageFormat class JavaDocs for more information." (http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#CSHID=pages_compref.htm|StartTopic=Content%2Fpages_compref.htm|SkinName=webhelp

 

Disregarding the move of that javadocs page, you can easily find the current documentations. But I can't seem to find any references on how to build patterns, or which patterns are possible to use. 

 

I've got a currency field in a  non SObject, so I can't use an outputfield to display it. I've been using a outputText with reasonable luck, see below.

 

<apex:outputText value="€ {0, number, ###,###.##}">
        <apex:param value="{!someCurrencyField}"/>
</apex:outputText> 

 

The only remaining issue, is to go from American decimal notation, to European,  atm it will display 10,000.55 , while my requirements are that to be 10.000,55.  I know a lot can be done with string functions, subtitute if contains etc. I know how to use those, I want to learn how to use format patterns appropriately and can not locatie information. Is there any ? 

 

Thanks to anyone who can provide some references, url's or a solution pattern for the above case.

 

 

Mitesh SuraMitesh Sura
Hi Samuel,

Any luck with this? I would like to format number fields as per dynamic format and cannot use outputField tag.