How to? push button in db1, select doc1 from view in db2, create doc2 with info from doc1 in db3?

how to: push button in db1, select doc1 from view in db2, create doc2 with infro from doc1 in db3?

I have done this before (I think), but it has been awhile and my scripts fingers are rusty… can I do this?

Want to push a button in db1, have the script open a notes ui view - pick a doc1, then have the script create a new doc2 in a third db with info from the doc1.

How does the script know I have selected a doc in the view and to move on with the rest of the tasks in the script? Is there a better/diff way to do this? Can I do this with @formulas?

Am I sure this is all very easy if you know how to do it? Help/thoughts/idea appreciated.

My rusty attempt below - some code from help is embedded - ignore.

Sub Click(Source As Button)

Dim session As New NotesSession	

Dim dateTime As New NotesDateTime(Cstr(Datenumber(2000, 5, 1)))



Dim thisdb As NotesDatabase

Dim i3DB As NotesDatabase

Dim ForecastDB As NotesDatabase



Set thisdb = session.CurrentDatabase





Dim workspace As New NotesUIWorkspace

Dim collection As NotesDocumentCollection

Dim FCdoc As NotesDocument

Dim i3Doc As NotesDocument

Dim uiview As NotesUIView

Dim picklist As Variant



Set i3DB = session.GetDatabase("server", "db.nsf")

Set ForecastDB  = session.GetDatabase("server", "db.nsf")



Call workspace.OpenDatabase( "server", "db.nsf", "view", "", False, False )

’ notesUIWorkspace.PickListStrings( type% [, multipleSelection ], server$, databaseFileName$, viewName$, title$, prompt$, column% [, categoryname$ ] )

’ picklist = workspace.PickListStrings( PICKLIST_CUSTOM, False, “server”, “db”, “view”, “pick this doc”, “prompt this”, 3)

Set collection = ForecastDB.UnprocessedDocuments

Set FCdoc = collection.GetFirstDocument



Set i3doc = New NotesDocument( thisdb )

i3doc.account = FCdoc.client(0)

Call i3doc.Save( False, False )	

’ Set uiview = workspace.CurrentView

’ Call notesUIWorkspace.OpenDatabase( server$, file$, view$, key$, newInstance, temp )

’ Call notesUIDatabase.OpenView( viewName$ [, key$] [, newinstance] [, replaceView] )

End Sub

Subject: script

dim s as new notessessiondim db as notesdatabase

set db = s.currentdatabase

dim was new notesuiworkspace

dim doccol as notesdocumentcollection

set doccol = w.picklistcollection(3, false, db.server, “Otherdbpath”, “viewnameinotherdb”, “choose”, “Select doc”)

if doccol.count = 0 then exit sub

dim doc as notesdocument

set doc = doccol.getfirstdocument

dim thirddb as notesdatabase

set thirdb = new notesdatabase(db.server, “anotherfilepath”)

dim newdoc as notesdocument

set newdoc = doc.copytodatabase(thirddb)

Try something like the above, use picklistcollection basically to get a doc from a different database. After that you can create a new document in another db, you don’t have to copy the document of course