+ Start a Discussion
StephenJacobGoldbergStephenJacobGoldberg 

Unknown property 'VisualforceArrayList

Hi.

 

I am getting the following error on a vforce page I am trying to create

 

Save error: Unknown property 'VisualforceArrayList.Description'

 

and I have no idea why.  I have treid using a list, and not using a list.  I have tried everything I can think of, but nothing seems to help.    Any help is much appreciate so thank you in advance.

 

Here is the relevant parts  of the controller class

 

public with sharing class Controller_QuotePage {
   public Quote qt {get; set;}
   public List<QuoteLineItem> theLineItems {get; set;}
   public Controller_QuotePage(ApexPages.StandardController controller) 
   {
       Id quoteID = ((Quote) controller.getRecord()).Id;
       loadQuote(quoteId);
       loadQuoteLineItems(quoteId);
    }
 	
    public List<QuoteLineItem> getLineItems(){
		 
		 return theLineItems;
    }
	

   private void loadQuote(String quoteId) {
        this.qt = [Select Id,  Site_Address__c,       
                  CreatedDate,ExpirationDate FROM Quote where    
                  Id=:quoteId];  
      
   }
    
   private void loadQuoteLineItems(String quoteId) {

       this.theLineItems = [SELECT Id, Description, Quantity, UnitPrice,
	     	            TotalPrice,Total_MRC__c,   Total_NRC__c    
                             FROM QuoteLineItem WHERE QuoteId =:   
                             quoteId];	
	   		
    }


}

 

 

And here is the relevant parts of the visualforce page

 

 

<apex:page standardController="Quote" renderAs="pdf"
	extensions="Controller_QuotePage">

<apex:dataTable value="{!LineItems}" var="LineItems">
<apex:column headerValue="Line Item" value="{!LineItems.Description}"/>
</apex:dataTable>


</apex:page>

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
aballardaballard

you need to change the apex:colum to reference the name used in the var ... that refers to the list item.   You code is referring to the whole list, wehich does, indded, not have a property called Description. 

All Answers

sfdcfoxsfdcfox

Do not use the same name for the variable as the data list element; it's finding the array instead of your repeat variable and thus giving you the error message. I had this problem in some of my development work, and I found that simply renaming either variable so they are distinct normally resolves the issue.

StephenJacobGoldbergStephenJacobGoldberg

sfdcfox, Thank you for the quick reply, but that didn't fix the problem

 

I made the change below, and it didn't resolve the problem I still get the same error.

 

 

 

<apex:dataTable value="{!LineItems}" var="LIs">
<apex:column headerValue="Line Item" value="{!LineItems.Description}"/>
</apex:dataTable>

 

Stephen

 

 

aballardaballard

you need to change the apex:colum to reference the name used in the var ... that refers to the list item.   You code is referring to the whole list, wehich does, indded, not have a property called Description. 

This was selected as the best answer
StephenJacobGoldbergStephenJacobGoldberg

aballard Thank you!

Amol SolankiAmol Solanki
You just have to use it like this:
Use your var variable in apex:column. 
 
<apex:dataTable value="{!LineItems}" var="LIs">
<apex:column headerValue="Line Item" value="{!LIs.Description}"/>
</apex:dataTable>