Solved

Search for duplicates

Posted on 2006-11-15
8
219 Views
Last Modified: 2013-12-18
Hi All,

I need your help once again. I have a view called duplicates and I need to write code that bring duplicates for a field called ApplicationNumber.

For Example

ApplicationNumber      First Name      Last Name
1111                  Paul            Janes
222                  Mary            Smith
111                  Peter            Cater

The view will show the following:

ApplicationNumber      First Name      Last Name
1111                  Paul            Janes
111                  Peter            Cater

Could any one help with this problem?  

Thanks in advance.
0
Comment
Question by:jose11au
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 18

Expert Comment

by:marilyng
ID: 17952009
Not quite understanding.  Neither view is showing a duplicate.. what makes 222 a duplicate?
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 17953887
yes....it is not at all lighting my mind.

Please tell in detail...
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17956014
Or did you mean 1111 in the two last cases? And you want that in a view? (I may get shot, but I'm going to say it again:) I think that's not possible.

If you want to remove duplicates, you will need some code to do that.
0
 
LVL 19

Assisted Solution

by:madheeswar
madheeswar earned 50 total points
ID: 17956175
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Expert Comment

by:behenderson
ID: 17959497
Put an @Text around the application number field in the column formula  @Text(ApplicationNumber) will order by first alphanumeric not by number
0
 
LVL 18

Assisted Solution

by:marilyng
marilyng earned 50 total points
ID: 17961537
Agreed, you not only need code, but you need a field that concatenates all values that might (together) indicate a duplicate.

for example:
1111*maryjones*dept1234*20061101
1111*maryjones*dept1234*20051105

Then you need to decide which record is the right one to keep - if you concatenate and sort ascending, categorized, then you will see which category has more than one entry, and which is the latest.

So a view navigator will locate the first category, and then tell you how many children are in the collection, skip the first, delete the rest.

maddy's links are helpful for base code to use.
0
 
LVL 8

Accepted Solution

by:
behenderson earned 400 total points
ID: 17962830
SOmething like the agent below will work.. I typed it out freehand so check it and test it first... But something like this should work

This agent marks both the first and second documents with the IsDuplicat flag.. you then create a view that includes only items with this flag and determine which doc you want to delete.

Dim db as NotesDatabase
dim vwApplicationNumbers as NotesView
dim doc as NotesDocument
dim docNext as NotesDocument
dim docWayNext as NotesDocument
dim strAppNum as String
dim strAppNumNext as String
set db = new NotesDatabase
set vwApplicationNumbers = db.getView( "Name of View" )
set doc = vwApplicationNumbers.GetFirstDocument
Do WHile Not doc is nothing
  docNext = vwApplicationNumbers.GetNextDocument( doc )
  If docNext is nothing then exit Do
  strAppNum = doc.ApplicationNumber(0)
  strAppNumNext = docNext.ApplicationNumber(0)
  Do while strAppNum = strAppNumNext
    doc.IsDuplicate = "1"
    docWayNext = vwApplicationNumbers.GetNextDocument( docNext )
    docNext.IsDuplicate = "1"
    call doc.save( true, true )
    call docNext.Save( true, true )
    If docWayNext is nothing then exit Sub
    set docnext = docWayNext
    strAppNumNext = docNext.ApplicationNumber(0)
  Loop
  Set doc = docNext
Loop
0
 

Author Comment

by:jose11au
ID: 17992137
Hi Guys,

Thanks for the help. My apologies for the delay in repying, been away from the office.

Regards,
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now