You need to sign in to do that
Don't have an account?
jdenning
Aggregate Functions returning blank results
I recently updated to 19.0 of the IDE from 16.0 and basic aggregrate queries are returning blank results:
SELECT Amount FROM Opportunity returns results
SELECT AVG(Amount) FROM Opportunity returns an empty result
Is there something I'm missing?
Please find below a sample code :
AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId];
System.debug('Average amount' + groupedResults[0]);
for (AggregateResult ar : groupedResults)
{
System.debug('Campaign ID' + ar.get('CampaignId'));
System.debug('Average amount' + ar.get('expr0'));
}
Hope this helps.
Thanks for the reply. it works as expected in code, but when trying to run the query with the salesforce.schema, it returns the CampaignId with an empty expr0.