Manage Learn to apply best practices and optimize your operations.

Find Documents In Db1 That Are Not In Db2 And Output Names To A Text File

This script is for two databases that are related to each other, usually via
linking documents.
ie. A client database, and a job order database.
The job orders are linked to the clients.

Using this example, it will output all names from the client database that do
not have a job order to a text file.

Programmer will have to change the ColumnValues section per what column they
need.
Dim db1 As NotesDatabase
Dim db2 As NotesDatabase
Dim view1 As NotesView
Dim view2 As NotesView
Dim doc1 As NotesDocument
Dim doc2 As NotesDocument

Set db1 = New NotesDatabase(Server, "db1.nsf")
Set db2 = New NotesDatabase(Server, "db2.nsf")
Set view1 = db1.GetView("VIEWNAME")
Set view2 = db2.GetView("VEIWNAME")
Set doc1 = view1.GetFirstDocument

While Not doc1 Is Nothing
Set doc2 = view2.GetDocumentByKey(doc1.ColumnValues(0), True)
If doc2 Is Nothing Then
Call writeToFile(Cstr(doc1.ColumnValues(1)))
End If
Set doc1 = view1.GetNextDocument(doc1)
Wend

************************
Sub writeToFile( notThere$)
Dim fileNum As Integer
fileNum% = Freefile()

Open "C:\Not There.txt" For Append As fileNum%

Print #fileNum%, notThere$
Close fileNum%
End Sub

Dig Deeper on Domino Resources - Part 6

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close