I'm trying to display subqueries columns on my Visualforce page but I can't.
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 like that I can display the columns from the father without problems, but when I try to display from children, I can't.
I didn't find any information about it.
Display children columns in my HTML in Visualforce.
You need <apex:repeat>
, <apex:datatable>
, <apex:pageBlockTable>
tags.
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_repeat.htm contains example of using repeat to access Account.Cases
. In your code it'll be repeat over {!formularioVisita.FormularioVisitaChild__r}