APEX CLASS:
 public class TestMapController{
    
     public map data {get;set;}
    
     public TestMapController(){
         data = new map();
         for(Account acc: [Select Id, Name, (Select Id, Name, Email from Contacts), Phone from Account]){
             integer count = data.get(acc.name);
             if(count != null)
                count++;
            else
                count = 1;
            data.put(acc.name, count);
        }
    }
}
VisualForce Page:

 
 
    
         {!d}
    

    
         {!data[d]}
    

 

 

Written by 

Salesforce MVP | Lightning Champion | 16x Salesforce Certified | Application Architect | 6x Trailhead Ranger | Techforce Services | Australia

Leave a Reply

Your email address will not be published. Required fields are marked *

*