+ Start a Discussion
Andy Kallio 7Andy Kallio 7 

Unknown Property on Custom Component Controller

Hello friends!

I cannot get this visualforce component to save. After trying a lot of different things in setting the properties i still get the error: Unknown property 'SObject.' on line 0.

Any guidance is greatly appreciated.


<apex:component controller="pdf_QLineItemGrouped2">

	<apex:attribute name="qlis" required="true" type="QuoteLineItem[]" assignTo="{!qli}" description="List of quote line items to be displayed."/>
    <apex:attribute name="totalPrice" required="true" type="Decimal" description="Quotes total sales price"/>
     <section >
         <table class="qitable">
                 <th class="row-name label" >Product</th>
                 <th class="row-date label">Description</th>
                 <th class="row-date label">Quantity</th>
                 <th class="row-status label">CPI</th>
                 <th class="row-status label">Total</th>
             <apex:repeat var="qli" value="{!groupedQLIs}">
                     <td class="row-name detail" >{!qli.['Family']}</td>
                     <td class="row-name detail" >{!qli['Quantity']}</td>
                     <td class="row-date detail">
                         <apex:outputText value="{0, number,currency}">
                             <apex:param value="{!qli.['Amount']}"/>
                     <td class="row-date detail">
                         <apex:outputText value="{0, number,currency}">
                             <apex:param value="{!qli.TotalPrice}"/>
             <tr class="label">
                 <td colspan="4" class="alignRight">Total:</td>
                     <apex:outputText value="{0, number,currency}">
                         <apex:param value="{!totalPrice}"/>
         <p style="page-break-after: always">Please note that prices do not include GST.</p>

public class pdf_QLineItemGrouped2 {
    public pdf_QLineItemGrouped2(){}
   public list<QuoteLineItem> qli {get; set;}
   set<Id> qlids = (new Map<Id, QuoteLineItem>(qli)).keySet(); 
   public list<SObject> groupedQLIs {
       get {return groupedQLIs;} 
       private set{
           groupedQLIs = [SELECT 
                       PricebookEntry.Product2.Family Family, 
                       SUM(Quantity) Quantity, 
                       SUM(CG_Total_Price__c) Amount
                       FROM QuoteLineItem
                       WHERE Id IN :qlids AND UnitPrice > 0
                       GROUP BY PricebookEntry.Product2.Family
                       ORDER BY PricebookEntry.Product2.Family ASC];
Raju yadavRaju yadav
Hi Andy Kallio 7,
Please use API Name of object pdf_QLineItemGrouped2 like this pdf_QLineItemGrouped2__c on controller.

Andy Kallio 7Andy Kallio 7
I have just figured out that the problem is with the rows. So, I am now past the initial error but still can't get the whole thing to compile. For example, this line does not compile
<td class="row-name detail" >{!qli.['Family']}</td>
I also tried this
<td class="row-name detail" ><apex:outputText value="{!qli.['Family']}"/></td>

and that gives me a different error: unknown component outputText

I found the syntax here: https://salesforce.stackexchange.com/questions/202953/unknown-property-sobject-why-cant-i-display-the-object
Andy Kallio 7Andy Kallio 7
Just needed to read that syntax a little more closely. Dots are not needed and should be this:
<td class="row-name detail" >{!qli['Family']}</td>