function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ramkumar MurugesanRamkumar Murugesan 

Agreegate results need to be compared with results

Hi Team,

I had issue with processing the results of agreegate query. I want to display the values and counts of whichdoesnt existing in the picklist field value. 

When the agreegate result should not contain the values of availablepicklist values. 

This is not working fine as per query. Can you please help on this. 
 
void checkPickListValues(){
            if(selectedField != null && selectedObject != null){
                UsedPicklistValues = new List<String>();
                String qryStr = 'Select ' + selectedField + ' pData, count(Id) tCount From ' + selectedObject + ' GROUP BY ' + selectedField;
                AggregateResult[] groupedResults =  Database.Query(qryStr);
                Summaries = new List<Summary>();
                for (AggregateResult ar : groupedResults){
                    system.debug(' ar ==>'+ar);
                    UsedPicklistValues.add((String)ar.get('pData'));
                    for (String availablepickval: PicklistValues){
                        
                        
                        if(ar.get('pData') != availablepickval && ar.get('pData')!= null ){                        
                        Summaries.add(new Summary((String)ar.get('pData'),(Integer)ar.get('tCount')));
                         
                        }  
                    }
                }