+ Start a Discussion
Sammy7Sammy7 

Unknown property 'VisualforceArrayLisy.description'

Hi, 
 Im new to visualforce and Im trying to understand why I cant iterate through the quote line items using the apex:repeat tag in the below SOQL:
 
<apex:page controller="myquote" showHeader="false" sidebar="false" >
  <apex:stylesheet value="{!URLFOR($Resource.advancedpdfresource, 'qstyles.css')}"/> 

    <apex:repeat value="{!quote}" var="qli">
        <apex:dataTable value="{!qli}" var="q" > 
            <apex:column style="border: 1px">
                <apex:facet name="header">Quote Line Item</apex:facet>
               <apex:outputText value="{!q.quotelineitems.description}"/> 

            </apex:column>
        </apex:dataTable>
    </apex:repeat>

</apex:page>

<!----Controller----->
public class myquote {

List <Quote> quote= [Select id, name, BillingAddress, BillingName, quotenumber,(SELECT id, Description, ListPrice, PricebookEntry.name, PricebookEntry.ProductCode, TotalPrice, Quantity FROM quotelineitems)  from QUOTE WHERE id=: ApexPages.CurrentPage().Getparameters().get('id')];
   
public List<Quote> getquote () {
      return quote;}          
      
                     }

 
Best Answer chosen by Sammy7
badibadi
modify your VF to the this 
<apex:page controller="myquote" showHeader="false" sidebar="false" >
  <apex:stylesheet value="{!URLFOR($Resource.advancedpdfresource, 'qstyles.css')}"/> 

    <apex:repeat value="{!quote}" var="qli">
        <apex:dataTable value="{!qli.quotelineitems}" var="q" > 
            <apex:column style="border: 1px">
                <apex:facet name="header">Quote Line Item</apex:facet>
               <apex:outputText value="{!q.description}"/> 

            </apex:column>
        </apex:dataTable>
    </apex:repeat>

</apex:page>

to iterate over child records you need to do this

    <apex:repeat value="{!quote}" var="qli">
        <apex:dataTable value="{!qli.quotelineitems}" var="q" > 

Hope it helps

All Answers

badibadi
modify your VF to the this 
<apex:page controller="myquote" showHeader="false" sidebar="false" >
  <apex:stylesheet value="{!URLFOR($Resource.advancedpdfresource, 'qstyles.css')}"/> 

    <apex:repeat value="{!quote}" var="qli">
        <apex:dataTable value="{!qli.quotelineitems}" var="q" > 
            <apex:column style="border: 1px">
                <apex:facet name="header">Quote Line Item</apex:facet>
               <apex:outputText value="{!q.description}"/> 

            </apex:column>
        </apex:dataTable>
    </apex:repeat>

</apex:page>

to iterate over child records you need to do this

    <apex:repeat value="{!quote}" var="qli">
        <apex:dataTable value="{!qli.quotelineitems}" var="q" > 

Hope it helps
This was selected as the best answer
Sammy7Sammy7
Excellent!  that fixed it, but why cant you access the child records list with the outputText component?
badibadi
[Select id, name, BillingAddress, BillingName, quotenumber,(SELECT id, Description, ListPrice, PricebookEntry.name, PricebookEntry.ProductCode, TotalPrice, QuantityFROM quotelineitems)  from QUOTE WHERE id=: ApexPages.CurrentPage().Getparameters().get('id')];

The inner query returns list of all child quotelineitems.Since its a list you have to iterate over the list and  cannot directly access it from outputText component,