Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 4 and 5 Forum

Notes/Domino 4 and 5 Forum

developerWorks

  

Sign in to participate PreviousPrevious NextNext

Help with Agent Code?
a b l 7.Nov.05 11:42 AM a Web browser
Domino Designer -- Agents 5.0.6 Windows NT

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)
. . RE: Help with Agent Code? (Ben Langhinrich... 7.Nov.05)
. . . . RE: Help with Agent Code? (Cesar Mugnatto 7.Nov.05)
. . . . . . RE: Help with Agent Code? (a b l 8.Nov.05)
. . . . RE: Help with Agent Code? (a b l 8.Nov.05)
. . RE: Help with Agent Code? (Bill Fox 9.Nov.05)
. . . . RE: Help with Agent Code? (a b l 10.Nov.05)






  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

  Lotus Support
Lotus Support
Product support pages index
Search knowledge base (Technotes)
Search support downloads
Lotus Support RSS

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
IBM Connections
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
IBM SmartCloud Meetings
IBM Web Content Manager
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Protector
Lotus Quickr
Lotus SmartSuite
Lotus Symphony
Lotus Symphony Developer Toolkit Support
Lotus Workflow