2

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

1 Answer 1

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 
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .