+ Start a Discussion
Rick_NookIndRick_NookInd 

Spring 2010 Aggregate Functions Bug?

I've been trying out the aggregate functions to see how useful it will be, and I ran into an error message that concerns me. System.Exception: field 'Subject' can not be grouped in a query call Here's the code: AggregateResult[] r_array = [SELECT Subject,Count(Id) FROM Task GROUP BY Subject]; for(AggregateResult r : r_array) { System.debug(r); }
Rick_NookIndRick_NookInd

"Some object fields have a field type that does not support grouping. You can't include fields with these field types in a GROUP BY clause. The Field object associated with DescribeSObjectResult has a groupable field that defines whether you can include the field in a GROUP BY clause."

 

http://www.salesforce.com/us/developer/docs/apipre/Content/sforce_api_calls_soql_select_agg_functions_field_types.htm

 

Not sure why that field wouldn't be groupable, but apparently it is not a bug.