+ Start a Discussion
ErrorProneErrorProne 

Aggravating AggregateResult

PHP API Call, 

 

I have a sum(Amout) in my Query which reutrns an "AggregateResult" 

 

how do I echo the AggregatedResult

kab1kab1

AggregateResult[] listData = [SELECT OwnerId, sum(Amount__c) amnt  From AmountData__c  GROUP BY OwnerId];

 

for (Sobject so : listData) {
AggregateResult ar = (AggregateResult) so;
Id OwnerId = (Id) ar.get('OwnerId');
Decimal tempAmount = (Decimal) ar.get('amnt');

}

 

 

Let me know if this resolves your issue