Domino Code Fragment

Code Name*
Export to text file
Date*
01/15/1999
Source (or email address if you prefer)*
Mackie
IP address:.3.128.203.143
Description*
Type*
LotusScript
Categories*
File Input/Output, Reporting/Searching
Implementation:
None (plug and play)
Required Client:
4.0
Server:
(none)
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
   ' This Script exports the view to c:\notes\reports\report.txt
     ' as tab-delineated text.
     
     Dim session As New NotesSession
     Dim db As NotesDatabase
     
     Set db = session.CurrentDatabase
     
     On Error Goto Problem
     Dim doc As NotesDocument
     Dim itm As NotesItem
     Dim txt As String
     Dim idx As Long
     Dim fil As Long
     
     
     Dim vw As NotesView
     Set vw =  db.GetView( "Reports" )
     
     '----- Open the specified file
     fil = Freefile()
     Open "C:\notes\reports\report.txt" For Output As fil
     
     '----- Iterate through the docs in the view
     idx = 0
     
     While True
          idx = idx + 1
          Set doc = vw.GetNthDocument(idx)
          If doc Is Nothing Then Goto TheEnd
          txt=""
          If idx=1 Then
               Forall COL In vw.Columns
                    txt = txt & COL.ItemName + "¬"
               End Forall
               Print #fil, txt
          End If
          Print "Exporting record #" & Trim$(Str(idx))
         
          '----- Iterate through view columns and export
          txt = ""
          Forall COL In vw.Columns
               If Strcomp(txt, "") Then txt = txt & "¬" ' Chr(9)
               txt = txt & ItemTextReturn(doc, COL.ItemName)
          End Forall
          Print #fil, txt
     Wend
     
TheEnd:
     If fil > 0 Then Close #fil
     
 ' Start Crystal Reporter as a normal (not minimized)
 ' window with focus.
     taskId% = Shell("Projexp.EXE", 1)    
     Exit Sub
     
Problem:
' Display the message "Report not available yet"
' in a message box labeled "Information." and containing
' OK button. Assign the return value from
' the MessageBox function to the variable answer.
     
     boxType& = 0 + 64
     answer% = Messagebox("Printed report feature is not installed or is not configured properly. Contact ****", boxType&, "Information")    
     Resume Next
     
     
End Sub