Can simple agent update document from other database

I am having a DetailedDatabase, upon update any document, it will save and also go to SummaryDatabase and pick up the document with the same region and month, than refreshed the document. what it will do is that in the summary database, documents were created which picked up total by region by month of all documents in the same region and month frm detaileddatabase.

problem is that I want to avoid writing lotus script, but cannot find simple function for this. can any one guide me on using @function or @command for this feature?

Tq.

Subject: can simple agent update document from other database

Use script, I’m pretty sure you can’t do this with formula language.

You need to persuade your employer to put you through a lotusscript course, would make your life a lot easier:)

Dan

Subject: RE: can simple agent update document from other database

tq Dan, you are really helpful. can you just tell me what function to use for it to look for databaseA, viewA.

I think I can search the book I just bought,written by Mark Elliot on searching the document with fieldCategory=A.

tq.

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

Subject: RE: can simple agent update document from other database

Tq vm Dan, you’re the King! really appreciates that!