Skip to main content
Hello,

I am trying to use AggregateResult to build a controller for a VF page.  This is the fist time that I am using this function and am recieving the error: 

Error: Compile Error: Missing '<EOF>' at 'public' at line 10 column 1

I have googled this like crazy, and seem to understand that it is because I have markup outside of the wrapper but I still can't understand how to fix it?  Can anyone help?

Here is my class: 

 

public class CurrentWeekDY{

String Campaign {get; set;}

String Delivery {get; set;}

public DelSum(string c, string d){

this.Campaign=c;

this.Delivery=d;

}

}

public List<DelSum> DelSumList = new List<DelSum>();

public List<DelSum> getDelSumOut(){

AggregateResult[] AgR = [SELECT Campaign_TL__c, SUM(Spend__c) FROM TL_Client__c WHERE CWDelivery__c = TRUE GROUP BY Campaign_TL__c ORDER BY Campaign_TL__c];

for (AggregateResult DYList : AgR) {

DelSumList.add(new DelSum(String.valueOf(DYList.get('Campaign_TL__c')), String.valueOf(DYList.get('expr0')), String.valueOf(DYList.get('expr1'))));

}

return DelSumList;

}

Thank you so much for any help!

John 
7 respostas
  1. 18 de jan. de 2018, 18:19
    From your original code your constructor has 2 parameters on line ⌗6:

    string c - which is being copied to this.Campaign

    string d - which is being copied to this.Delivery

    on line ⌗18 you are creating a new DelSum class, which is calling the constructor on line ⌗6.  You are calling with 3 parameters, but it is only defined with 2 parameters.

    what is 'expr0' supposed to be, and what is 'expr1' supposed to be?  Double check your SOQL query on line ⌗15, make sure you are passing the right parameters in the right order on line ⌗18, then make sure the constructor definition on line ⌗6 matches your reference on line ⌗18.

    Does this make sense, or did I lose you with these steps?
0/9000