+ Start a Discussion
SFineSFine 

Formatting Currency

Hello,

 

I have checked the boards and tried the samples, but for some reason when I used this bit of code to format my currency:

 

         <apex:outputText value="Rs{0,number, $###,##0.00}">
             <apex:param value="${!opp.Total_Referrals__c}"/>
         </apex:outputText>

 

I get this error:

 

Error: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.

 

I'm clueless in what to do. I merely wish for a basic currency formatting technique. If you can offer any advice, I'd be appreciative.

Best Answer chosen by Admin (Salesforce Developers) 
SSRS2SSRS2

Hello SFine 

  The reason for giving error incorrect usage of '$' symbol (<apex:param value="${!opp.Total_Referrals__c}"/>)

If you want to format currency and get output with Rs use following

 

 <apex:outputText value="Rs{0, number, ###,##0.00}">
   <apex:param value="{!opp.Total_Referrals__c}"/>
 </apex:outputText>

 -Suresh 

 

All Answers

DharmeshDharmesh
You can format the value in Apex controller class and then display on VF.
SSRS2SSRS2

Hello SFine 

  The reason for giving error incorrect usage of '$' symbol (<apex:param value="${!opp.Total_Referrals__c}"/>)

If you want to format currency and get output with Rs use following

 

 <apex:outputText value="Rs{0, number, ###,##0.00}">
   <apex:param value="{!opp.Total_Referrals__c}"/>
 </apex:outputText>

 -Suresh 

 

This was selected as the best answer
SFineSFine

Thanks SSR. That worked perfectly.

manan patel 7manan patel 7
i want to convert currency format 1'000 instad of 1,000 in visual force page please help to out of this. actually, this  is Switzerland currency format