I want to format my Amount with currency and at the same time use the condition contains, bur I'm not sure how to put it

Currency is working:

<apex:outputText  value="{0, number, currency}" rendered="{!relatedTo.Amount < 25000 }">
<apex:param value="{!ABS(relatedTo.Amount)}" />. 

but I need to add another condition using if contains. Below is not working when using value with currency format and if contains

<apex:outputText value="{0, number, currency} {!if(CONTAINS(relatedTo.Product_Details_vfe__c,"Esri Inc") &&  relatedTo.Amount < 25000,
'<br>this ' + RelatedTo.Amount + '</br>
','')}" escape="false"/>

You can decompose the problem into pieces

  • The rendering condition (in a wrapper outputPanel)
  • The markup including formatted currency

    <apex:outputPanel rendered="{!CONTAINS(relatedTo.Product_Details_vfe__c,'Esri Inc') &&
                              relatedTo.Amount < 25000}">
      <apex:outputText value="{0, number, currency}">
        <apex:param value="{!ABS(relatedTo.Amount)}" /> 
      ..more markup
|improve this answer|||||
  • This is VF email template, is apex:outputPanel will work on email template? – Smurfet Apr 7 '19 at 5:49
  • Yep, no problem – cropredy Apr 7 '19 at 5:50
  • Hi Cropedy... tried you code by got this error "apex:outputPanel" must be terminated by the matching end-tag "</apex:outputPanel>" <apex:outputPanel rendered="{!CONTAINS(relatedTo.Product_Details_vfe__c,"Esri Inc") && relatedTo.Amount < 25000}"> <apex:outputText value="{0, number, currency}"> <apex:param value="{!ABS(relatedTo.Amount)}" /> </apex:outputText> </apex:outputPanel> – Smurfet Apr 7 '19 at 6:00
  • @Smurfet - fixed - had doublequotes around Esri ... when it should have been single quotes – cropredy Apr 8 '19 at 17:44

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.