0

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)}" />. 
</apex:outputText>

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"/>

1 Answer 1

1

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}">
      ..somemarkup.. 
      <apex:outputText value="{0, number, currency}">
        <apex:param value="{!ABS(relatedTo.Amount)}" /> 
      </apex:outputText>
      ..more markup
    </apex:outputPanel>
    
4
  • This is VF email template, is apex:outputPanel will work on email template?
    – Smurfet
    Apr 7, 2019 at 5:49
  • Yep, no problem
    – cropredy
    Apr 7, 2019 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, 2019 at 6:00
  • @Smurfet - fixed - had doublequotes around Esri ... when it should have been single quotes
    – cropredy
    Apr 8, 2019 at 17:44

You must log in to answer this question.

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