Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
 
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 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

PreviousPrevious NextNext


Joshua Martin 6.Jul.09 11:16 PM a Web browser
Domino Designer 6.5.5 FP2 Windows XP


Greetings,

I have the following code which runs once a night to go through a selected view of documents to clear out a Rtf and update the Rtf with new links based on computed fields.

The problem is that the agent clears the field on most, but not all, of the documents, therefore creating duplicate links. All of the links work fine, but there are duplicates. Each time the agent runs it'll just continue to make more dupes.

Any ideas on why this isn't clearing the field on ALL of the documents before doing the update? Of course this didn't present in testing - only in production. Sigh.

Thanks in advance!
Josh

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim view As NotesView
Dim rtitem As NotesRichTextItem
Dim uidoc As NotesUIDocument, uidocNew As NotesUIDocument
Dim lookupdoc As NotesDocument
Dim polnum As String
Dim title As String
Dim varArray As Variant
Dim doc As notesdocument

Dim dc As notesdocumentcollection

Set dc = db.unprocesseddocuments

For i = 1 To dc.count
Set doc = dc.getnthdocument(i)


' ***BEGIN TEST FOR LOCK***

If Not doc.LockHolders(0) = "" Then 'If document is locked, exit sub

Goto Continue
Else

If doc.AllCrossRefDocIDs(0) <> "" And doc.ref_last_updated_date(0) <> "" Then ' Doc must have doc ids in AllCrossRefDocIDs field, has to have been updated or converted
flag=doc.computewithform(True,False) 'check for valdiation errors
If flag Then
Set rtitem = doc.GetFirstItem("AllCrossRefsNotes") ' Set variable for field for adding links to/updating
doc.AllCrossRefsNotes = "" ' Clear field for links first so it doesn't make duplicates if run twice.

varArray = doc.AllCrossRefDocIDs 'list of document ids for creating links to

Forall noteID In varArray 'loop through list of docids
Set lookupdoc = db.GetDocumentByUNID( noteID ) 'get a handle on the backend document
polnum = lookupdoc.PolicyNumber(0) 'get the policy number of the document
title$ = lookupdoc.Title(0) 'get the title of the document
Call rtitem.AppendDocLink( lookupdoc, "", polnum & " " & title) 'insert the link with policy number and title
Call rtitem.AddNewLine( 1 ) 'add a line after the link and loop back until end.
doc.ref_last_updated_date = Now()
End Forall
Call doc.Save (True, False) 'Save backend document
End If
End If
End If
Continue:
Call session.UpdateProcessedDoc(doc) 'unique to this agent
Next
End Sub






Help - Agent inconsistent (Joshua Martin 6.Jul.09)
. . Re: Help - Agent inconsistent (Jerry Glover 7.Jul.09)
. . RE: Help - Agent inconsistent (Watka Naidoo 7.Jul.09)
. . . . RE: Help - Agent inconsistent (Joshua Martin 7.Jul.09)
. . . . RE: Help - Agent inconsistent (Joshua Martin 8.Jul.09)





  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

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

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
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


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite