Posts Topics Forums Images
Search videos from message boards Videos Search messages from microblogs Microblogs Search messages from imdb.com Imdb Search messages from yuku.com Yuku Search messages from lefora.com (free forums) Lefora
My account: Login | Sign Up
Loading... 

Thread: Community - How to delete the duplicate records from the database - Apex Code Development - Force.com Discussion Boards

Started 1 month ago by Shanky77
Hi Can any body tell me how to delete the duplicate record from the database. This duplicate reocrd is judged on the basis of comparing each field of one record with the each field of the other record. I used two for loops for this . Every time I m comparing the index of 1st record with the rest of the records then again i m jumping to the next index and coampring with the ...
Site: Salesforce.com Community  Salesforce.com Community - site profile
Forum: Apex Code Development  Apex Code Development - forum profile
Total authors: 3 authors
Total thread posts: 5 posts
Thread activity: no new posts during last week
Domain info for: salesforce.com

Other posts in this thread:

ThomasTT replied 1 month ago
I don't know your definition of "duplicated records", but with assuming "records with the same sobject type (Account) and name", you just use Map . Map doesn't allow same keys, and O(1) to get a object with using the key. You may need a logic to determine which record of duplicated 2. If it kis just to delete, Map.values() is useful to get the all objects at the end. - ThomasTT

ThomasTT replied 1 month ago
If you need to compare multiple fields to determine if they are duplicated, you may go with different approach. Assuming you "query" those records to get them, you put all fields to compare in Order By clause. If there is a duplicated record, it must be just after the record, so you just always check if previous one and the current one are the same or not. It's a old school, but still ...

Pragadheeshwari replied 4 weeks, 1 day ago
can you post the code,then it will be helpful for me to give suggestions

Shanky77 replied 4 weeks, 1 day ago
Code is pasted below. Please let me know what best could be done to overcome governor limt problem contactRoleAccountList = [select Account__c,Contact__c,Start__c,Role_Played__c,End_ Date__c from Contact_Role__c where Account__c != null]; if(!contactRoleAccountList.isEmpty()) { for(Integer i=0;i<...

 

Top contributing authors

Name
Posts
ThomasTT
2
user's latest post:
Community - How to delete the...
Published (2009-11-09 06:49:00)
If you need to compare multiple fields to determine if they are duplicated, you may go with different approach. Assuming you "query" those records to get them, you put all fields to compare in Order By clause. If there is a duplicated record, it must be just after the record, so you just always check if previous one and the current one are the same or not. It's a old school, but still useful. - ThomasTT
Shanky77
2
user's latest post:
Community - How to delete the...
Published (2009-11-10 02:37:00)
Code is pasted below. Please let me know what best could be done to overcome governor limt problem &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;contactRoleAccountList&nbsp;=&nbsp;[select&nbsp;Account__c,Contact__c,Start__c,Role_Played__c,End_Date__c&nbsp;...
Pragadheeshwari
1
user's latest post:
Community - How to delete the...
Published (2009-11-09 23:21:00)
can you post the code,then it will be helpful for me to give suggestions

Related threads on "Salesforce.com Community":

Related threads on other sites:

Thread profile page for "Community - How to delete the duplicate records from the database - Apex Code Development - Force.com Discussion Boards" on http://www.salesforce.com. This report page is a snippet summary view from a single thread "Community - How to delete the duplicate records from the database - Apex Code Development - Force.com Discussion Boards", located on the Message Board at http://www.salesforce.com. This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity