+ Start a Discussion
etechcareersetechcareers 

expecting a left angle bracket, found 'queryResults' ????

Hi:

   Does anyone know what is wrong with my statement:

 

public class Productff {

//Define your variables
public class OppStageHolder {
    public String OPP {get; set;}
    public Integer TTL_Opp {get; set;}
//Empty Array    
public OppStageHolder (){}
}
//Results will be placed within this List
public List queryResults {get;set;}

//Your Page
public PageReference TTL() {

AggregateResult[] groupedResults = [SELECT Product_Name__c, Sum(TotalPrice) ce FROM OpportunityLineItem 
                                    GROUP BY Product_Name__c];  
System.Debug('zzavg ' + groupedResults.size());
//Define your List
queryResults = new List();

for (AggregateResult ard : groupedResults)  {    
    OppStageHolder myObject = new OppStageHolder();    
    myObject.OPP = String.valueOf(ard.get('Product_Name__c'));    
    myObject.TTL_Opp = (Integer) ard.get('ce');         
    queryResults.add(myObject);    
}
return Page.TTL;
}


}

 

 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

The compiler needs to know what type of data you will put in your list.  Looking at your code, it appears to be your custom class:

 

 

public List<OppStageHolder> queryResults {get;set;}

 

 

 

All Answers

bob_buzzardbob_buzzard

The compiler needs to know what type of data you will put in your list.  Looking at your code, it appears to be your custom class:

 

 

public List<OppStageHolder> queryResults {get;set;}

 

 

 

This was selected as the best answer
etechcareersetechcareers

Thank you that was a silly mistake hehehe