You need to sign in to do that
Don't have an account?
igorcguedes
Example from Visualforce page:
Display Child result from Sub-Querry at VisualforcePage
Hi!
I got some trouble trying to display the sub-querry from Child fields.
Apex controller:
public class FormController { private final FormularioDeVisita__c formulario; public FormularioVisitaPdfController() { if(ApexPages.currentPage().getParameters().get('id') != null){ formulario = [ SELECT ChequeEmpresa__c, SedePropria__c, CNPJ__c, MercadoExternoCliente__c, DataFundacao__c, (SELECT FormInfoPercent__c, FormInfoText__c, FormInfoCheckbox__c, FormInfoDate__c, FormInfoCurrency__c, FormInfoPercentDecimal__c, FormularioVisita__c from FormularioVisitaChild__r) from FormularioDeVisita__c WHERE Id = :ApexPages.currentPage().getParameters().get('id')]; } } public FormularioDeVisita__c getformularioVisita() { return formulario; } public PageReference save() { update formulario; return null; } }
Example from Visualforce page:
<tr> <td class="table td">Mercado livre?</td> <td class="table td_right">{!formularioVisita.MercadoLivre__c}</td> </tr>
Using that format i can display the Father querrys without problem: {formularioVisita."any"}.
But when i try to use a field from the sub-querry, i cant make it work.
Thanks for any help!
You will have to use <apex:repeat> to display all the child elements.
For reference : https://developer.salesforce.com/forums/?id=9062I000000IMjCQAW