You need to sign in to do that
Don't have an account?

Help Navigating Soql query in visualforce
Hi, I created a parent to child query that will relate son to father but I can not get the Name, Age__c from the Father__r. I am trying to return results in my visualforce page using outputfield. Could any one help.
son = [select Id, First_Name__c, Last_Name__c, Age__c,
(Select Id, Name, Age__c From Fathers__r)
from Son__c
where name=:ApexPages.currentPage().getParameters().get('id')];
<apex:outputField value="{}"/>
<apex:outputField value="{}"/>
<apex
utputField value="{!son.Fathers__r.Name}"/>
Assuming that the relationship name is correct!
Cool_D
When I try to put that in I get this error:
Hey
Your current query is child to parent btw i.e. sons are children of parents, and your 'main' query object is son. Therefore your query should be:
Your page could then output the father's details like so:
<apex:outputText value="{!son.fathers__r.name} />
Wes