Processing your aggregate
function in your apex class or trigger.
Whenever if you are using
aggregate function in your SOQL query you must group those selected fields in
your query. In the below query i have queried profileId field so need to group
this field.
To process your aggregate
function soql query you must use the AggregateResult
- List<AggregateResult> ui=[Select count(Id) cnt,ProfileId from User where Profile.Name='Customer Portal Manager Custom' group by ProfileId];
- for(AggregateResult ar: ui)
- {
- String str = '' + ar.get('ProfileId') ; //Get profileId
- String str1 = '' + ar.get('cnt') ; //Get count of Id using the alias name
- }
Nice article Kept Up
ReplyDelete214 Read About Area Code which State Locations, cities, Timezone.