0

I have a Table to display some values of a list within Apex:repeat. This list contains both parent and child records of objects. The question is i want to display a child record value in a TD context based on a condition.

My list looks like

custList = [Select Id, Name, (Select Id, Name, customfield__c From CustomObject__c) From Case LIMIT 100] 

And my table looks like

<apex:repeat value="{!custList}" var="var">
<tr>
<td>{!var.Id}</td>
<td>{!var.Name}</td>
<td>//Child value should goes here//</td>
</tr>
</apex:repeat>

I have started with following option

<td>
<apex:repeat value="{!var.CustomObjects__r}" var="var2">
<apex:outputText value="{!var2.customfield__c}" rendered="true"/>
</apex:repeat>    
</td> 

How can we do this?

  • what is issue here? are you unable to implement the condition for displaying the data? – Ratan Paul May 10 '17 at 7:58
0

you know which field you are going to show in apex repeat conditionally.you can use rendered with some other value.you can use the same condition in rendered potion as well like below : -

    <apex:repeat value="{!custList}" var="var">
    <tr>
    <td>{!var.Id}</td>
    <td>apex:outputText value="{!var2.customfield__c}" rendered="{!var2.customfield__c!=null}"/></td>
//here i am giving the example you can checking whether the name value is null or not.
    <td>//Child value should goes here//</td>
    </tr>
    </apex:repeat>

like this you can use your condition.

| improve this answer | |

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.