Automatic Data Dumping

I am trying to access Project Names and numbers stored in a Lotus Notes database from another program.  What I would like to do is set up an automated job that dumps down a spreadsheet with this information whenever I go into the database (preferably on exiting it).  Does anyone have any suggestions?  Thanks.
LVL 3
kaldrichAsked:
Who is Participating?
 
KimdaCommented:
this script exports PROJECTNAMEFIELD and PROJECTNUMBERFIELD , all documents in current view to: c:\export.txt
the fields are seperated with ";"
you must modify the PROJECTNAMEFIELD and PROJECTNUMBERFIELD to the names of the fields in your form.

include the script in the INITIALIZE EVENT of your VIEW, or make an ACTION BUTTON for the view, which i personally would do, so that you can controll when this happen. so not all of the users of the database suddenly get an c:\export.txt

Sub txtfileexport
     Dim db As notesdatabase
     Dim s As New notessession
     Dim Session As New notessession
     Dim doc As notesdocument
     Dim utv As notesdocumentcollection
     Dim filenum As Integer
     Dim fileName As String, oppslag As String, fileNameH As String
     Dim fileext As String
     Dim filepath As String
     Dim program As String
     Dim  platform As String
     Dim commandSet As String
     Dim n As Integer
     Dim c As Integer
     Dim lrc As Long
     Dim answer As Integer
             
     Dim PROJECTNAMEFIELD as string
     Dim PROJECTNUMBERFIELD as string
     
         
          fileNum% = Freefile()
         
          fileName$ = "c:\export.txt"
         
          On Error Resume Next
          Kill fileName$
         
         
          Set db = s.CurrentDatabase
          Set utv = db.UnprocessedDocuments
          Set doc = utv.GetFirstDocument
          c = utv.count

'******* writes header-record to datafile **********    
         
         
         
         
         
          Open fileName$ For Append As fileNum%
         
          Print #fileNum%, "Projeckt name" & ";"  & "Project number"
          Close fileNum%    
'*********************************************************    
         
          i = 0
         
          While Not doc Is Nothing                  
                    PROJECTNAMEFIELD = doc.PROJECTNAMERFIELD(0)
                    PROJECTNUMBERFIELD = doc.PROJECTNUMBERFIELD(0)
                   
                   
                   
'          Print  linje$,  kunde
               Open fileName$ For Append As fileNum%
               Print #fileNum%, PROJECTNAME & ";"  & PROJECTNUMBER
               Close fileNum%          
               
               Set doc = utv.GetNextDocument(doc)
               i = i+1
          Wend


     
End Sub
0
 
HemanthaKumarCommented:
Could u please be specific

Hemanth
0
 
kaldrichAuthor Commented:
Looks good.  I may have to modify the formats of the fields a bit, but I can work it from here.  Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.