This is my VF outputtext which works fine:

<apex:repeat value="{!port.hList}" var="per">
       <apex:outputText value="{0, Number, #,###,###.00}" rendered="{!per.unit__r.listing__r.value__c != 0}">
         <apex:param value="{!per.unit__r.listing__r.value__c}"/>

When I change the != to > or <, it fails. The field being checked is a formula(Currency) field which should allow <> checks surely?

I want to add formatting based on whether the value is negative (ie put brackets around the value), but because the < fails, I can't do this. Anyone have any ideas why?

  • I discovered the value = null, which is why it's failing. If I add a null check before the > then it works. – Irene Jan 13 '20 at 2:28
  • 2
    Irene, please post an answer to your question as a service to the community – cropredy Jan 13 '20 at 4:18

If the value of the field in the comparison is null, then == and != still work, but > or < causes an error. As the check is in VF, I added an additional check in the rendered section for null value like this:

<apex:outputText value="{0, Number, #,###,###.00}" 
    rendered="{!per.unit__r.listing__r.value__c != null 
                && per.unit__r.listing__r.value__c < 0}">

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.