Updating a field in number of documents with the input from a dialogbox

Hi, I’m an extreme novice at Notes development and would appreciate some guidence with what I am trying to achieve. I’ve done a lot of searching without finding what I need.

Say I have a view with 100 documents that has a title field that is the same in all of the documents.

I have a text file with 100 lines of different titles and I want to be able to take these 100 lines from the text file and update the title field in my documents. The end result would be the 100 documents in the view displaying the same titles as are in my text file.

An agent from one of the old forums is as close as I’ve found, but this sets all of the fields to be the same as what is entered in the dialogbox.

http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/04d880b5c5006603852569750071fa8f?OpenDocument

Thanks for any help or assistance on this and I hope this makes sense.

Subject: Code Example

Here is some code that can be modified to do what you need. It reads values from a delimited text file and updates documents in a View.=========================================

The routine demonstrates flat file importing with LotusScript. It shows how to read a comma separated file. It then merges the results into existing records in the database. These records are keyed on a uniqueId. You should be able to easily modify this routine to create instead of merge or perhaps do both depending on if the record already exists or not.

=========================================

Sub Initialize

 On Error Goto AError

 Dim bFileOpen As Integer

 Dim session As New NotesSession

 Dim db As NotesDatabase

 Set db = session.CurrentDatabase 

 Dim view As NotesView

 Dim doc As NotesDocument

 Set view = db.GetView( "Your View Name" )

 Set doc = view.GetFirstDocument

'The Fields we are going to import

 Dim Field1 As String

 Dim Field2 As String

'The unique field for each record

 Dim UniqueID As String

'Name of file to get from user

 Dim FileName As String

 If Not (doc Is Nothing) Then

      FileName = Inputbox$("Enter your import file name: ", "LotusScript Import Routime", "C:\")

      If (FileName = "") Then

           Messagebox ("Import has been canceled")

           Exit Sub

      End If

 Else

'There is nothing to merge into

      Messagebox ("Nothing to import into! Are you sure you have not already imported this file?")

      Exit Sub

 End If

'Open the file

 Dim fileNum As Integer

 fileNum = Freefile()

 Open FileName For Input As fileNum

 bFileOpen = 1

 Dim item As NotesItem

'Until we eof

 Do Until Eof (fileNum)

      Input #fileNum, UniqueID, Field1, Field2

      If (UniqueID > "") Then

           Set doc = view.GetDocumentByKey(URN)

           If Not (doc Is Nothing) Then

                doc.Field1 = Field1

                doc.Field2 = Field2

                Call doc.Save(True, False)

           Else

                Messagebox("File contains a record that is not in the database " + UniqueID)

           End If

      Else

           Messagebox("File contains an record without a unique id")

      End If

 Loop

'Close file

 Close fileNum

 bFileOpen = 0

 Messagebox("File imported successfully")

 Exit Sub

AError:

 If (bFileOpen = 1) Then

      Close fileNum

 End If

 Messagebox("Error importing data: " + Error$)

 Exit Sub

Subject: sorry, wrong thread