You need to sign in to do that
Don't have an account?
HARSHIL U PARIKH
How to take a size for this "res": AggregateResult res : [SELECT Custom_field__C];
Hello Developers,
I am trying to take a size for this variable "res" from this SOQL query---> AggregateResult res : [SELECT Custom_field__C];
I am using Count__C = res.size() it throws an error as
Method does not exist or incorrect signature: [AggregateResult].size()
I know I can use .size() on list but I am not sure about on this "res."
Thank you for the help!
I am trying to take a size for this variable "res" from this SOQL query---> AggregateResult res : [SELECT Custom_field__C];
I am using Count__C = res.size() it throws an error as
Method does not exist or incorrect signature: [AggregateResult].size()
I know I can use .size() on list but I am not sure about on this "res."
Thank you for the help!
Integer count = [select count() from account where name like '%a%'];
system.debug('count : ' + count);
or
Alain
All Answers
1) https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_agg_fns.htm
2) http://blog.jeffdouglas.com/2010/04/12/using-aggregateresult-in-salesforce-com-soql/
Let us know if that will help you
Integer count = [select count() from account where name like '%a%'];
system.debug('count : ' + count);
or
Alain
This is the query I have Now on Transaction_Count__C I need to update that AggregateResult's size or number of records in that query.
This is the error I am getting,
Method does not exist or incorrect signature: [AggregateResult].size()
Just need to write Transaction_Count__C = (Integer) res.get('Quantity') instead of Transaction_Count__C = res.size()
Thanks!