0

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

    </apex:pageblocktable>

enter image description here

2 Answers 2

0

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

to

<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.

5
  • You can mark it as resolved if it working for you.
    – Ankita
    Commented Jul 20, 2017 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
    Commented Jul 21, 2017 at 8:55
  • We are handling this condition in rendered. Try this as it was working for me
    – Ankita
    Commented Jul 21, 2017 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
    Commented Jul 21, 2017 at 9:14
  • Do mark it resolved if it is working for you.
    – Ankita
    Commented Jul 21, 2017 at 9:16
0

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

You must log in to answer this question.

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