Retrieving data from lotus NotesDatabase using lotusScript
I am new in lotusScript and lotus notes. I can retrieve data from database using notesView. Here is path of my lotusScript code for that:
Sub getViewData
Dim session As New NotesSession
Dim db As NotesDatabase
Dim mainDoc As NotesDocument
Set db = session.CurrentDatabase
Dim collection As NotesDocumentCollection
Set collection = db.AllDocuments
Dim fileName As String
Dim fileNum As Integer
Dim item As NotesItem
Forall v In db.Views
Set mainDoc = v.GetFirstDocument
fileNum% = Freefile()
fileName$ = "C:\AllViewsData\" & v.name & ".txt"
Open FileName$ For开发者_C百科 Append As fileNum%
Write #fileNum% , "////// VIEW NAME:" & v.name & "////////////"
Set mainDoc = v.GetFirstDocument
While Not ( mainDoc Is Nothing )
Forall i In mainDoc.Items
ss = ss & " " & i.Name
End Forall
Write #fileNum% , ss
Set mainDoc = v.GetNextDocument( mainDoc )
Wend
Close fileNum%
End Forall
End Sub
I designed sql(relational) table for each notesForms. I was trying to retrieve data using notesForm and store that in corresponding table but I could not do that :( Any help is highly appreciated.
Form describes the schema / UI for your data. What you actually need to export / query are the Lotus Notes documents in the database, not the forms.
As for views, these are simply a "window" on your data, and again don't need to be explicitly exported. There's a very similar post to yours here, and my answer covers the difference between data, forms and views:
How to get the underlying view of a form using lotusscript
精彩评论