In Start Method I use Aggregated Query (queries use GROUP By ),then how to check In Execute Method the Aggregate Query how much record Fetch Limit & Number of records we can get using Aggregate Query
here I'm trying like
global class AggregateQueryBatch implements Database.Batchable<AggregateResult> {
global Iterable<AggregateResult> start(Database.BatchableContext bc){
String query = 'SELECT COUNT(Id), Account__c FROM account_allowances__c GROUP BY Account__c';
return new AggregateResultIterable(query);
}
global void execute(Database.BatchableContext bc, List<sObject> scope){
for(sObject sObj : scope) {
AggregateResult ar = (AggregateResult)sObj;
System.debug('>>>> COUNT : ' + ar.get('cnt'));
}
}
global void finish(Database.BatchableContext bc){
}
}
and get error like "Invalid type: AggregateResultIterable" please give me the best suggestion to find the limit and number of record fetch by using of Aggregate Query. Here "account_allowances__c" have more then 50,000 record Thanks
List<AggregateResult>
,Opportunity
,JSON.deserialize()
) or define them yourself if they don't exist.AggregateResultIterable
isn't provided by Apex, and you haven't made an Apex class for that, so you, unsurprisingly, get an error.