I need to use group by cube to display the count of added services for each group for each package. I get an error on line 18: method does not exist or incorrect signature: void get(String) from the type List. How do I correct for this?
public class AddedServicesGrouping {
public list<Inspection__c> inspections = [SELECT Id, (SELECT Added_Services_Group__c, Inspection_Package__c, Id
FROM Inspection_Services__r)
FROM Inspection__c
WHERE Status__c = 'Completed' AND Month_Since_Launch__c > 0];
public list<Inspection__c> getservices(){
for(Inspection__c i: inspections){
for(Inspection_Service__c addedservices : i.Inspection_Services__r){
AggregateResult[] ar =
[SELECT Added_Services_Group__c AddedService, count_distinct(id) cnt, Inspection_Package__c Package,
GROUPING(Added_Services_Group__c), GROUPING(Inspection_Package__c)
FROM Inspection_Service__c
GROUP BY CUBE (Added_Services_Group__c, Inspection_Package__c)];
integer n = integer.valueof(ar.get('cnt'));
}
}
return inspections;
}
}