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
krish@123krish@123 

​Please any body suggest me.I want to display duplicate records list on VF page. after click for duplicates button click...... Please find the below code


Iam able to dispaly only one record out of 4duplicate records.

kindly help for me 


<apex:commandButton action="{!Next}" value="Check for Duplicates" status="status" reRender="duplicate"/>

 <apex:outputPanel id="duplicate">
              <apex:pageBlock title="Potential duplicates">
          <apex:pagemessage strength="2" title="Error!!" severity="error" detail="This Record Already Exists !!!" rendered="{!errormsg}"/><!-- End of error message -->
               <apex:pageblocktable rendered="{!NOT(ISNULL(existingcon))}" value="{!existingcon}" var="case" id="dup">
                               <apex:column headervalue="Select">
                                       <apex:commandlink action="{!SelectDuplicates}">
                                           <input type="radio" name="ContactSel"/>
                                       </apex:commandlink>                                         
                              </apex:column>
                              <apex:column headervalue="Name"> <apex:outputtext value="{!newcon.lastname}"/>  </apex:column>
                              <apex:column headervalue="Description"> <apex:outputtext value="{!newcon.email}"/>  </apex:column>
               </apex:pageblocktable>
     
 </apex:pageBlock>  </apex:outputPanel>


public List<Contact> chkdup;
public Contact newcon= new Contact();
public contact getcon()
 {
     return con;
 }
 public contact getexistingcon()
 {
     if (chkdup!= NULL)
     {
     if(chkdup.size()>0)
         return con;
     else
         return null;
     }
     else
         return null;
 }
public pagereference Next()
{
 chkdup=[select id,Lastname,Email from Contact where Lastname=:con.Lastname ];
 if(chkdup.size()>=0)
 {
      String tnum=con.Lastname;
     
      return null;
 }
 else
 {
       
       return null;
 }

}

Thanks
Best Answer chosen by krish@123
surasura
try below . you should iterate chkdup list in pageblock table  not existingcon.

controller 
 
public List<Contact> chkdup {get;set;}
public Contact newcon= new Contact();
public contact getcon()
 {
     return con;
 }
 public contact getexistingcon()
 {
     if (chkdup!= NULL)
     {
     if(chkdup.size()>0)
         return con;
     else
         return null;
     }
     else
         return null;
 }
public pagereference Next()
{
 chkdup=[select id,Lastname,Email from Contact where Lastname=:con.Lastname ];
 if(chkdup.size()>=0)
 {
      String tnum=con.Lastname;
     
      return null;
 }
 else
 {
       
       return null;
 }

}
page
<apex:commandButton action="{!Next}" value="Check for Duplicates" status="status" reRender="duplicate"/>

 <apex:outputPanel id="duplicate">
              <apex:pageBlock title="Potential duplicates">
          <apex:pagemessage strength="2" title="Error!!" severity="error" detail="This Record Already Exists !!!" rendered="{!errormsg}"/><!-- End of error message -->
               <apex:pageblocktable rendered="{!NOT(ISNULL(existingcon))}" value="{!chkdup}" var="case" id="dup">
                               <apex:column headervalue="Select">
                                       <apex:commandlink action="{!SelectDuplicates}">
                                           <input type="radio" name="ContactSel"/>
                                       </apex:commandlink>                                         
                              </apex:column>
                              <apex:column headervalue="Name"> <apex:outputtext value="{!newcon.lastname}"/>  </apex:column>
                              <apex:column headervalue="Description"> <apex:outputtext value="{!newcon.email}"/>  </apex:column>
               </apex:pageblocktable>
     
 </apex:pageBlock>  </apex:outputPanel>




 

All Answers

surasura
try below . you should iterate chkdup list in pageblock table  not existingcon.

controller 
 
public List<Contact> chkdup {get;set;}
public Contact newcon= new Contact();
public contact getcon()
 {
     return con;
 }
 public contact getexistingcon()
 {
     if (chkdup!= NULL)
     {
     if(chkdup.size()>0)
         return con;
     else
         return null;
     }
     else
         return null;
 }
public pagereference Next()
{
 chkdup=[select id,Lastname,Email from Contact where Lastname=:con.Lastname ];
 if(chkdup.size()>=0)
 {
      String tnum=con.Lastname;
     
      return null;
 }
 else
 {
       
       return null;
 }

}
page
<apex:commandButton action="{!Next}" value="Check for Duplicates" status="status" reRender="duplicate"/>

 <apex:outputPanel id="duplicate">
              <apex:pageBlock title="Potential duplicates">
          <apex:pagemessage strength="2" title="Error!!" severity="error" detail="This Record Already Exists !!!" rendered="{!errormsg}"/><!-- End of error message -->
               <apex:pageblocktable rendered="{!NOT(ISNULL(existingcon))}" value="{!chkdup}" var="case" id="dup">
                               <apex:column headervalue="Select">
                                       <apex:commandlink action="{!SelectDuplicates}">
                                           <input type="radio" name="ContactSel"/>
                                       </apex:commandlink>                                         
                              </apex:column>
                              <apex:column headervalue="Name"> <apex:outputtext value="{!newcon.lastname}"/>  </apex:column>
                              <apex:column headervalue="Description"> <apex:outputtext value="{!newcon.email}"/>  </apex:column>
               </apex:pageblocktable>
     
 </apex:pageBlock>  </apex:outputPanel>




 
This was selected as the best answer
krish@123krish@123
Hi 

Thanks for reply I got it.