You need to sign in to do that
Don't have an account?
Accessing Single Aggregate Result
Hi All
I am trying to access a single aggregate result as in the follows (this is not meant to be a group of results!)
decimal totaldebitorder = [select sum(amount__c) tot from Debit_Order_Transaction__c where Credit_agreement_No__c=:ca.id ].tot;
I am getting Invalid field tot for SObject AggregateResult error.
Please help?
thanks in advance
Ross
hi,
Just use This Query
Decimal.valueof(String.valueof(
decimal totaldebitorder =Decimal.valueof(String.valueof( [select sum(amount__c) tot from Debit_Order_Transaction__c where Credit_agreement_No__c=:ca.id ][0].get('tot')));
If this is a answer then put this post as a solution..
Hi,
Try this :
decimal totaldebitorder = (Decimal) [select sum(amount__c) tot from Debit_Order_Transaction__c where Credit_agreement_No__c=:ca.id ][0].get('tot');
Hi,
Try the below code as reference:
decimal totaldebitorder = (Decimal) [select sum(amount__c) tot from Debit_Order_Transaction__c][0].get('tot');
system.debug('@@@@@@@@@@@@@@@@' + totaldebitorder);
For more details please go through the link below:
http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_agg_fns.htm
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Hi,
Try the below code as a reference...
AHHHH Nevermind :)