Import data in a view in Lotus Notes

Mark Bakelaar
Mark Bakelaar used Ask the Experts™
Hi Experts,
I would like to add a button to a Lotus Notes application that deletes all records and then imports new records from preferably an xls or otherwise a wk4 file.

Does someone have a code snippet showing how I can do this?

Regards, MB

The above is a simplification of the following procedure:
1. Every morning an Excel macro is copying the sheet "current" to "previous".
2. Then current is refreshed by pulling data from an oracle DB
3. The sheet difference is updated
4. An wk4 export file is created
5. In notes manually all records are deleted
6. The wk4 export file is imported

The above could most likely also be solved completely in Lotus Notes without Excel, but I am not sure how complicated this task is in Lotus Notes and therefore the question to just delete all records and connect to Excel.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
For deletion of all the docs,
You can use below code before running excel import:
Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim view As NotesView
  Dim doc As NotesDocument  
  Set db = session.CurrentDatabase
  Set view = db.GetView("Folder1") 'View name
  Set doc = view.GetFirstDocument()
  While Not(doc Is Nothing)
     Call doc.Remove(True)
     Set doc = view.GetFirstDocument()
In order to do these, you need to have good idea on Lotus Script classes.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial