You need to sign in to do that
Don't have an account?
How to write query for fetching record from level 2 child object ?
I am writing SOQL query with respect to Parent like this.
Parent --> Level_1_Child --> Level_2_child
Apex code:
List<Parent> lstParent =
[
Select parent.id, parent.name,
(
select id, name , (Select id, name from Level_2_Child__r)
from Level_1_Child__r
)
From ParentObject
];
But this is not working.
VF code :
<apex:repeat value="{!lstParent}" var="rec">
<apex:outputText value="{!rec.name}" />
<apex:repeat value="{!rec.Level_1_Child__r}" var="rec1">
<apex:outputText value="{!rec1.name}" />
<apex:repeat value="{!rec1.Level_2_Child__r}" var="rec2">
<apex:outputText value="{!rec2.name}" />
</apex:repeat>
</apex:repeat>
</apex:repeat>
above VF code has no erros , compiles successful, but Apex code is giving error hence i am not able to fetch data from Level 2 child,
If i removed Level 2 child from Apex and VF then All is good.
Please help me to get this corrected or any other Gud solution except iterating the Level 1 child to get Level 2 child records.
http://boards.developerforce.com/t5/Apex-Code-Development/multidimensional-lists/td-p/177454
This might help you