Subject: RE: can simple agent update document from other database
Assuming you have a view that is categorised (or at least sorted) by your key (bit like using an @dblookup in formula), do something like:
dim s as new notessession
dim db as notesdatabase
set db = s.currentdatabase
'now get the other database, assuming it’s on the same server
dim otherdb as notesdatabase
set otherdb = new notesdatabase(db.server, “Filename of other database.nsf”)
'get the relevant view from the other database
dim view as notesview
set view = otherdb.getview(“ViewName”)
'get the current document of course
dim w as new notesuiworkspace
dim uidoc as notesuidocument
set uidoc = w.currentdocument
'look up the doc in the other database view (assuming you’ll only have one document that matches, if there’s more than one it will return the first one in the view)
dim otherdoc as notesdocument
set otherdoc = view.getdocumentbykey(uidoc.fieldgettext(“KeyField”))
'update the other doc
if not (otherdoc is nothing) then
otherdoc.fieldvalue1 = uidoc.fieldgettext(“Fieldvalue1”)
'and any other fields that need changing
call otherdoc.save(true, true)
Dan