• Rohit Wardole
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hey Plz chk the Error i want to display the AggregateResult on my Visualforce page but it is generating Error " Invalid field Email for SObject AggregateResult" the code is given below

public with sharing class searchDuplicate {
   public   AggregateResult[] con{get;set;}
   
   public searchDuplicate()
   {
       find();
   }
    public void find(){
      con = [select Email from Contact group by Email having count(Email) > 1];
        System.debug(con);
    }
}

 and Visual Force code is

<apex:page controller="searchDuplicate">
    <apex:pageBlock title="Searching for Duplicate Contacts Record"> 
    </apex:pageBlock>
    <apex:pageBlock title="Contacts">
        <apex:dataTable value="{!con}" var="c" border="2" cellspacing="5" cellpadding="5">
            <apex:column headerValue="Email" value="{!c['Email']}" />
        </apex:dataTable>
    </apex:pageBlock>     
</apex:page>