+ Start a Discussion
Sean NolansSean Nolans 

If statement on VF page for field output


I wish to render an field output on a VF page if another field value is  > 0 

 <apex:pageBlockSection >
  
  <apex:outputField> value= "{!IF(order__c.hss_qty_price__c >  0, "This includes HSS and Stay Behind price",  "All clear no extras" )} />
             
  
   </apex:pageBlockSection>


This is hwo it works in my formula but I have hit a compile error there so need to move into a page

IF(hss_qty_price__c > 0, "This price includes HSS price",  "All clear no extras" 
Raj VakatiRaj Vakati
You need to use rendered attribute to do it
          
          <apex:outputText rendered="{!IF(order__c.hss_qty_price__c >  0')}" value=" This includes HSS and Stay Behind price"/>
          <apex:outputText rendered="{!IF(order__c.hss_qty_price__c < 0')}" value=" All clear no extras"/>
 
Sean NolansSean Nolans
@raj h

Getting



Error: rendered="{!IF(order__c.hss_qty_price__c &gt; 0')}" EL Expression Unbalanced: ... {!IF(order__c.hss_qty_price__c &gt; 0')}
Error: EL Expression Unbalanced: ... {!IF(order__c.hss_qty_price__c &gt; 0')}

when I try your suggestion -

Any ideas ?

thanks

D
Sokheng YinSokheng Yin
Hello @Sean Nolans
I fact issue EL Expression Unbalanced. Have you solved it yet?