+ Start a Discussion
maddukurimaddukuri 

Currency symbol

In the VF page, I am trying to display $ and , symbols only if there is a value. If there is no value, I do not want the symbols to show. I have the line as

<td><apex:outputText value="{!ROUND((acc.Box_Charge__c*acc.X12_Mth_Containers__c)/12,2)}"></apex:outputText></td>

 

acc is the account. Only if the value is not null, I need to add the $ and comma symbols. Please help

Best Answer chosen by Admin (Salesforce Developers) 
SFDC_VikashSFDC_Vikash

Hi,

 

You can use this :

 

<apex:outputText value="{!IF(TEXT(ROUND(acc.Box_Charge__c*acc.X12_Mth_Containers__c)/12,2)) = '', '', '$' + TEXT(ROUND(acc.Box_Charge__c*acc.X12_Mth_Containers__c)/12,2)))}"/>

 

Please mark as solution if your problem is solved so that others can use this solution.

 

 

All Answers

SFDC_VikashSFDC_Vikash

Hi,

 

You can use this :

 

<apex:outputText value="{!IF(TEXT(ROUND(acc.Box_Charge__c*acc.X12_Mth_Containers__c)/12,2)) = '', '', '$' + TEXT(ROUND(acc.Box_Charge__c*acc.X12_Mth_Containers__c)/12,2)))}"/>

 

Please mark as solution if your problem is solved so that others can use this solution.

 

 

This was selected as the best answer
maddukurimaddukuri

Thank You Very Much! It worked!!!!!