| Dim StrBuffer As String
|
| Dim FieldBuffer As String
|
| Dim ReportID As Long
|
|
|
| Dim session As NotesSession
|
| Dim db As NotesDatabase
|
| Dim collection As NotesDocumentCollection
|
| Dim doc As NotesDocument
|
|
|
| Dim FieldValue As Variant
|
| Dim FieldList List As String
|
| Dim FieldCount As Long
|
| Dim Counter As Long
|
|
|
| Set session =New NotesSession
|
| Set db = session.CurrentDatabase
|
| Set collection = db.UnprocessedDocuments
|
|
|
| REM Initialize buffer for the selected report name
|
| StrBuffer = Space(254)
|
|
|
| REM Call the report selection ( "StrBuffer" will then contain the selected name)
|
| If NTPReportList ( StrBuffer ) >= 0 Then
|
| StrBuffer = Trim ( StrBuffer )
|
|
|
| REM Count the number of fields in the report file
|
| FieldCount = NTPGetFieldCount ( StrBuffer )
|
|
|
| REM Get all field names from the report file and save as a list
|
| For Counter = 1 To FieldCount
|
| FieldBuffer = Space(254)
|
| NTPGetFieldName StrBuffer, Counter, FieldBuffer
|
| FieldBuffer = Trim ( FieldBuffer )
|
| FieldList( FieldBuffer) = FieldBuffer
|
| Next Counter
|
| REM Initialize new report and memorize report number
|
| ReportID = 0
|
| ReportID = NTPInit ( StrBuffer, 0)
|
|
|
| If ReportID >= 0 Then
|
| REM Initialize status bar (pass max. value! )
|
| NTPOpenStatusBar ReportID, Collection.Count
|
| REM Run all documents...
|
| For i = 1 To collection.Count
|
| Set doc = collection.GetNthDocument( i )
|
| Forall x In FieldList
|
| REM Read field contents to be passed
|
| FieldValue = doc.GetItemValue( Listtag(x) )
|
| REM Send field read
|
| NTPSendField ReportID, FieldValue(0)
|
| End Forall
|
| REM Signal end of a data set
|
| NTPEndDocument ( ReportID )
|
|
|
| REM Refresh status bar
|
| NTPUpdateStatusBar ReportID, i
|
| Next
|
| REM Close status bar
|
| NTPCloseStatusBar (ReportID)
|
|
|
| REM End spooling
|
| NTPEnd ( ReportID )
|
|
|
| REM Initialize buffer for the selected report name
|
| StrBuffer = Space(254)
|
|
|
| REM Read name of the spool file created
|
| NTPGetDataFileName ReportID, StrBuffer
|
|
|
| REM Execute report created...
|
| NTPProcessReport Trim ( StrBuffer ), 1, 1, 1, 1
|
| End If
|
| End If
|