You need to sign in to do that
Don't have an account?

Odd Date Behavior
Hello. I am running into an error after tweaking a previously-working AggregateResult line of code. Does anyone have any guidance as to what is the best way to proceeed.
In the below code, I am trying to limit my query to the past seven days (note 'system.today()-7'). Unfortunately, I am receiving errors for the "ClosingDate__c = QueryDate" section of the AggregateResult line. I have tried to insert brackets, single quotes, etc...and receive some sort of error message each time. Can anyone provide some guidance?
Thanks in advance.
public Date QueryDate { get; set;} QueryDate = (system.today() - 7); AggregateResult[] ar = [SELECT sum(CustomerDollars__c) FROM Customers__c WHERE ClosingDate__c = QueryDate GROUP BY ClosingDate__c ORDER BY sum(CustomerDollars__c) desc LIMIT 1];
Is it just that it needs the colon?
WHERE ClosingDate__c = :QueryDate
All Answers
Is it just that it needs the colon?
WHERE ClosingDate__c = :QueryDate
I totally missed that. Thanks much.