1

In my visualforce page, i am displaying amount data and it is working fine if the amount is a positive number. But if it is negative amount then the data is enclosed in a parentheses. But, i need a minus symbol prefixed in front of the amount like the one given below.

-$16,77,390

I am using the following code on the vf page to display the currency data.

        <apex:outputText label="Credit Exposure" id="creditexposure" value="{0,number,currency}">  
            <apex:param value="{!CustCreditInfo.CreditExposure}" />  
        </apex:outputText>              

It displayed as,

enter image description here

3

This formatting pattern {0,number,$#,##0.00} with these sample values:

<apex:page >
<apex:outputText value="{0,number,$#,##0.00}">  
    <apex:param value="{! 12345.25 }" />  
</apex:outputText>
<br/>
<apex:outputText value="{0,number,$#,##0.00}">  
    <apex:param value="{! 0.25 }" />  
</apex:outputText>
<br/>
<apex:outputText value="{0,number,$#,##0.00}">  
    <apex:param value="{! -12345.25 }" />  
</apex:outputText>
<br/>
<apex:outputText value="{0,number,$#,##0.00}">  
    <apex:param value="{! -0.25 }" />  
</apex:outputText>
<br/>  
</apex:page>

produces these output:

$12,345.25 
$0.25 
-$12,345.25 
-$0.25 
| improve this answer | |

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.