+ Start a Discussion
Sunny_SlpSunny_Slp 

Rendering outputText based on a List using IF

I'm using rendered attribute of the <apex:outputText> to display a section header only when the section has elements to display.

 

This is what I have

 

Note: copays_Retail is List of objects retruned by the controller method getcopays_Retail

 

<apex:outputText rendered="{!If(copays_Retail!=NULL,True,False)}"><b>Retail</b></apex:outputText>
 <apex:repeat value="{!copays_Retail}" var="cps">

 this always hides the section header, if I use {!If(!copays_Retail!=NULL,true,false)} gives an error saying that NOT() function expected Boolean but found an Object. Using just  copays_Retail!=NULL always hides it.  I want the outputText element be displayed when copays_Retails is not NULL or has more than 0 elements. How do I acheive this?

 

Thank you,

Sunny_Slp

Starz26Starz26

Try

 

rendered="{!NOT(copays_Retail.empty)}"