0
votes

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 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.

1
You're going to have to post the code that isn't working, along with the error you're getting - at the moment, this question looks like you want someone to write the code in the inner loop for you.Eight-Bit Guru
What, exactly, are you trying to accomplish? There is rarely a simple one-to-one mapping between a Notes document and a row in a relational database table (unless there is something seriously wrong with your understanding of relational databases). If you need enterprise data synchronization, then you should probably be looking at products like Lotus Enterprise Integrator for Domino or Notrix.Stan Rogers
@Jonners: thanks for ur quick reply. I have posted my whole code here, i want same thing using notesForm.ura-dhura
I think I understand now -- and there's a reason why you can't find a way to do what you want. Forms don't contain data (well, they contain design data, but not user data). Documents do. In your posted example, you are retrieving data from documents -- the view is just giving you a list of documents from which to get the data. Forms have no idea which documents were created using them; when you open a document, the form is retrieved based on the value stored in its Form field. In order to gat all of the documents associated with a particular form, you need a view selecting them or a search.Stan Rogers
@Stan Rogers: thank you very much. Now we are trying with View selection form.ura-dhura

1 Answers

0
votes

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