my controller is :

public List<case> getCases(){
    List<case> listCase =[SELECT (SELECT ActivityDate, Description,subject,Status,IsTask FROM OpenActivities where ActivityDate <= :x_date),
    (select id,oldvalue, newvalue,createdDate,createdby.name from histories where createdById <> '00558000001NGFq'),id,contact.lastname,contact.firstname,createdDate,caseNumber FROM case where DAY_ONLY(createdDate )= :x_date ];

    return listCase; 

My visualforce :

apex:pageblocktable value="{!Cases}" var="c">
         <apex:column headerValue="Numéro de la demande" value="{!c.caseNumber}"/>
         <apex:column headerValue="Prénom" value="{!c.contact.FirstName}"/>
         <apex:column headerValue="Nom" value="{!c.contact.LastName}"/>
         <apex:column headerValue="Modification faite par" value="{!c.histories[0].createdby.name}"/> 
         <apex:column headerValue="Date première modification" value="{!c.histories[0].createdDate }"/>
         <apex:column headerValue="Sujet" value="{!c.OpenActivities[0].subject}" rendered="{!IF(AND(NOT(ISBLANK(c.OpenActivities)),c.OpenActivities.size>0),TRUE,FALSE)}"/>
         <apex:column headerValue="Task" value="{!c.OpenActivities[0].isTask}" rendered="{!IF(AND(NOT(ISBLANK(c.OpenActivities)),c.OpenActivities.size>0),TRUE,FALSE)}"/>
         <apex:column headerValue="Statut" value="{!c.OpenActivities[0].status}" rendered="{!IF(AND(NOT(ISBLANK(c.OpenActivities)),c.OpenActivities.size>0),TRUE,FALSE)}"/>
         <apex:column headerValue="Date de l'activité" value="{!c.OpenActivities[0].activityDate}" rendered="{!IF(AND(NOT(ISBLANK(c.OpenActivities)),c.OpenActivities.size>0),TRUE,FALSE)}"/>


enter image description here


The rendered attribute in the apex:column is not letting the header value to be displayed as its value is false. Change the rendered value from

<apex:column headerValue="Sujet" value="{!c.OpenActivities[0].subject}" rendered="{!IF(AND(NOT(ISBLANK(c.OpenActivities)),c.OpenActivities.size>0),TRUE,FALSE)}"/>


<apex:column headerValue="Sujet" value="{!c.OpenActivities[0].subject}" rendered="{!c.OpenActivities.size != 0}"/>

Change it for all the apex:column where you have written rendered.

  • You can mark it as resolved if it working for you. – Ankita Jul 20 '17 at 9:26
  • but in case, the list of the subquery is empty (i think), they show the following error : Subscript is invalid because list is empty – Mus Jul 21 '17 at 8:55
  • We are handling this condition in rendered. Try this as it was working for me – Ankita Jul 21 '17 at 8:57
  • i have the error only on the date of 14/05/2017 i will look into it, to see why, thanks any way – Mus Jul 21 '17 at 9:14
  • Do mark it resolved if it is working for you. – Ankita Jul 21 '17 at 9:16

I did an other solution i checked the subquery in the controller so if it is empty i add blank values to the fields.

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.