You need to sign in to do that
Don't have an account?
Mahesh Dhara 9
Hi Refer Below code I commented Particular block there anyone can plz provide me solution
public class LeadDuplicateFinder_AC {
public List<WraperClass> Summaries { get; set; }
Integer recordLimit = 25;
Integer offSetLimit = 0;
public Integer totalRecords=0;
public LeadDuplicateFinder_AC(){
totalRecords=[select count() from Lead];
Set<String> emails=new Set<String>();
List<AggregateResult> results = [select count(id)name,email from lead where email!=null group by email having count(id)>2 Limit :recordLimit OFFSET :offSetLimit ];
//System.debug(results);
for (AggregateResult ar : results) {
Integer count=0;
count=(Integer)ar.get('Name');
if(count>2){
emails.add((String)ar.get('Email'));
}
}
List<String> dupEmails=new List<String>();
Summaries = new List<WraperClass>();
for(Lead l:[select name,email from Lead where email in:emails]){
//here before adding to Summaries list if any existing email record is there check first if it is ther dont add to the list
if not ther add to the list plz provide me logic how to do
Summaries.add(new WraperClass(l));
}
}
Public void Next(){
offSetLimit = offSetLimit + 25;
System.debug(offSetLimit);
}
Public void Previous(){
if(offSetLimit > 0)
offSetLimit = offSetLimit - 25;
}
public Boolean getPrev(){
if(offSetLimit==0)
return true;
else
return false;
}
public Boolean getNxt(){
if((offSetLimit+recordLimit)<totalRecords)
return false;
else
return true;
}
public class WraperClass{
public String Name { get;set;}
public String Email { get;set; }
public WraperClass(Lead l){
Name=l.Name;
Email=l.Email;
}
}
}
public List<WraperClass> Summaries { get; set; }
Integer recordLimit = 25;
Integer offSetLimit = 0;
public Integer totalRecords=0;
public LeadDuplicateFinder_AC(){
totalRecords=[select count() from Lead];
Set<String> emails=new Set<String>();
List<AggregateResult> results = [select count(id)name,email from lead where email!=null group by email having count(id)>2 Limit :recordLimit OFFSET :offSetLimit ];
//System.debug(results);
for (AggregateResult ar : results) {
Integer count=0;
count=(Integer)ar.get('Name');
if(count>2){
emails.add((String)ar.get('Email'));
}
}
List<String> dupEmails=new List<String>();
Summaries = new List<WraperClass>();
for(Lead l:[select name,email from Lead where email in:emails]){
//here before adding to Summaries list if any existing email record is there check first if it is ther dont add to the list
if not ther add to the list plz provide me logic how to do
Summaries.add(new WraperClass(l));
}
}
Public void Next(){
offSetLimit = offSetLimit + 25;
System.debug(offSetLimit);
}
Public void Previous(){
if(offSetLimit > 0)
offSetLimit = offSetLimit - 25;
}
public Boolean getPrev(){
if(offSetLimit==0)
return true;
else
return false;
}
public Boolean getNxt(){
if((offSetLimit+recordLimit)<totalRecords)
return false;
else
return true;
}
public class WraperClass{
public String Name { get;set;}
public String Email { get;set; }
public WraperClass(Lead l){
Name=l.Name;
Email=l.Email;
}
}
}
You can change the dupEmails type as Set of String and change the code like below,
Let me know if that works for you.
Best Regards,
BALAJI