Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating Multiple Documents

Status
Not open for further replies.

Earthworks

IS-IT--Management
Sep 30, 2003
16
GB
I have some work done for new documents in a postsave event.
(create 11 related sub documents using @DocumentUniqueID to link them)

However, I have 400 existing documents that I want to run this work on.

If I can open each in edit mode and save again, hopefully my postsave event will run and the work will be applied to the 400 existing documents.

From a SQL man... How would one run this update in Notes?
 
I would put your code in an agent (will probably require modifying it a bit), set said agent to run on selected documents, and select the 400 that should be updated.

Oh, and you'll need at least to be able to run said agent from the Agent menu.

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
Thanks - what needs changing? The agent does not appreciate me cutting and pasting from the querysave event.

Code Below:

Dim session As New NotesSession

Dim workspace As New NotesUIWorkspace

Set uidoc = workspace.CurrentDocument

Set db = session.CurrentDatabase

Set uidoc = workspace.CurrentDocument

' create a new empty message docuument
Set doc = New NotesDocument( db )

' set the document name
doc.Form = "Application Message"

'set message type
doc.MessageType = "Dashboard"

' link dashboard message to parent application
doc.PIDLink = uidoc.FieldGetText("PIDHidden")
' populate document fields
doc.MessageHeading = "Dashboard 11 - Business Continuity Management"

' save dashboard message
Call doc.Save (True,False)

do this 10 more times .....
 
If the copy paste doesn't work, maybe you forgot to indicate that the agent is supposed to be a Script agent ? I think it does default to Simple Formula.

Beyond that, for an agent that runs on selected docs, you need to make the selection available to the agent. There is no more UIdoc, it is replaced by db.UnprocessedDocuments.

Like this :
Code:
Dim session As New NotesSession
Dim db As Notesdatabase
Dim coll as NotesDocumentCollection
Dim doc as NotesDocument
Dim olddoc as NotesDocument

Set db = session.CurrentDatabase
set coll = db.UnprocessedDocuments
if coll.count>0 then
    set doc = coll.GetFirstDocument
    Do While Not(doc Is Nothing)
        ...'create your link docs here
        Set olddoc = doc
        Set doc = coll.GetNextDocument(olddoc)
        delete olddoc
    Loop
End If

That's how I would do it.

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top