Solved

Search for duplicates

Posted on 2006-11-15
8
228 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Assisted Solution

by:madheeswar
madheeswar earned 50 total points
ID: 17956175
0
 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

688 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