Help with Lotus Script - copying the current view to another databases

Hi all.

I need some help with Lotus Script - as I don’t really know much! I’ve managed to piece together the script below by reading through various posts on this forum, and it works great.

The only problem is that I have to put the view name in to the code (Set view = db.getview(“ABC1”)

). I'd like it to always run this from the view that the user is currently in. Can someone please tell me how I can do this? I presume it's something to do with setting uiview, but I don't quite get this part yet...

Thanks!

Alex

Sub Initialize

Dim w As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim response As Variant

Dim results As Variant

Dim cmd As String

Dim session As New NotesSession

Dim db As NotesDatabase

Dim db2 As New NotesDatabase(“myServer”,“Archive\archive”&Trim(response)&“.nsf”)

'this is the name of the 2nd database

Dim view As NotesView

Dim doc As NotesDocument

Dim doc2 As NotesDocument

cmd = {@DbColumn(“”:“NoCache”; “MyDominoDirectoryRepID”; “Case Archives”; 1)}

results = Evaluate(cmd)

response = w.Prompt (PROMPT_OKCANCELLIST, “Select a Case Code”, “Select a Case Code”, results, results)

Set db = session.currentdatabase

Set view = db.getview(“ABC1”)

If view.name = “” Then Exit Sub

Set doc = view.getfirstdocument 'get the first doc in the folder

'check to make sure 2nd database is open, if not, open it

If Not (db2.isopen) Then

Call db2.open(“myServer”,“Archive\archive”&Trim(response)&“.nsf”)

End If

'Now get the rest of the documents from the folder and move it to the

'other database

Do

Set doc2 = doc.copytodatabase(db2)

Set doc = view.getnextdocument(doc)

Loop While Not (doc Is Nothing)

End Sub

Subject: use uiworkspace to get the current view

You can use the uiworkspace object to get the current uiview using the currentView property of the uiworkspace object.

Then use the “viewname” property on the uiview object to get the name of the current view.

Look in designer help for more details.

Hope this helps

Renaud

Subject: That worked - thanks very much! [EOM]