I have the following piece of code:
map<id,List<Spot__c>> spotMap = new map<id,List<Spot__c>>();
List<application__c> apPList = [SELECT ID, Account__r.id,(SELECT id,status__r.name FROM Spot__r ) FROM application__c WHERE Account__r.id in :scope];
Set<id> apPIdSet = new Set<id>();
for(application__c app: apPList){
spotMap.put(app.id, app.Spot__r );
}
How do I iterate over the map and get the status__r.name value
I need to count all the same statuses of all the related applications and update these on the Account. The account then shows the total count for each status over all related applications. Since I cannot do this with for loop in a for loop I though I had to this with a map. I now get how to iterate over the spotMap but still having some issue to relate that to the related account.