Showing posts with label Sales force. Show all posts
Showing posts with label Sales force. Show all posts

23 Mar 2017

Sales Force List of List Object

Remote Action List of List Object

global with sharing class TagLogApp {
    public static List<List<Object>> getChartData() {
        List<List<Object>> data = new List<List<Object>>();
        Object locName;
        String locValue;
      
        List<AggregateResult> locationNames = [select Location__c,COUNT(Name) cnt from Tag_Log__c GROUP BY Location__c ];
        data.add(new List<Object>{'Locations', 'Tag Count'});
        
        for(AggregateResult rd : locationNames) {
            locName = rd.get('Location__c'); 
            locValue = locName  != Null ? (String)locName : 'Others';
            data.add(new List<Object>{locValue , Double.ValueOf(rd.get('cnt'))});           
        }        
        return data;
    }

   @RemoteAction
   public static  List<List<Object>>  GetAll(String searchText)
   {
        return TagLogApp.getChartData();
   }     
}