New to the Lotus Script world. I have some programming skills but limited. Can someone help me decipher this Agent code? No, one else seems to have a clue...and our application is broken. Here's the code? Thanks :-)!!
Sub UpdateIndexDB
Dim sess As New NotesSession
Dim db As NotesDatabase
Dim indexDB As NotesDatabase
Dim ndc As NotesDocumentCollection
Dim indexView As NotesView
Dim doc As NotesDocument
Dim indexDoc As NotesDocument
Dim fieldValues As Variant
Dim v As Variant, v2 As Variant
Set db = sess.CurrentDatabase
Set indexDB = sess.GetDatabase (db.Server, “support\index.nsf”)
Set indexView = indexDB.GetView (“Documents”)
Set ndc = db.UnprocessedDocuments
Set doc = ndc.GetFirstDocument
Do Until doc Is Nothing
If Ucase$ (doc.form(0))=”MAINDOC” Then
Set indexDoc = indexView.GetDocumentByKey (doc.doc_number(0), True)
If Not indexDoc Is Nothing Then indexDoc.Remove True
Set indexDoc = doc.CopyToDatabase (indexDB)
If indexDoc.HasItem (“ScannedFileFieldList”) Then fieldValues = indexDoc.GetItemValue(“ScannedFileFieldList”)
Forall field In fieldValues
If field <> “” Then
Set v= indexDoc.GetFirstItem (Cstr(field))
If v.Type = RICHTEXT Then
Set v2 = v.CopyItemToDocument (indexDoc, “Body”)
Else
If indexDoc.HasItem (“Body”)
Then
Set v2 = indexDoc.GetFirstItem (“Body”)
Else
Set v2 = indexDoc.CreateRichTextItem (“Body”)
End If
v2.AppendText v.Text
End If
v2.AddNewLine 1
End If
End Forall
End If
If indexDoc.HasItem (“AttachedFileFieldList”) Then fieldValues = indexDoc.GetItemValue (“AttachedFileFieldList”)
Forall field In fieldValues
If field <> “” Then
Set v = indexDoc.GetFirstItem (Cstr(field))
If v.Type = RICHTEXT Then
Set v2 = v.CopyItemToDocument (indexDoc, “Body”)
Else
If indexDoc.HasItem (“Body”)
Then
Set v2 = indexDoc.GetFirstItem (“Body”)
Else
Set v2 = indexDoc.CreateRichTextItem (“Body”)
End If
v2.AppendText v.Text
End If
v2.AddNewLine1
End Forall
End If
IndexDoc.Save True, False
End If
sess.UpdateProcessedDoc doc
Set doc = ndc.GetNextDocument (doc)
Loop
End Sub

Help with Agent Code? (a b l 7.Nov.05)
. . 