View export agent

This code allows you to export information from a view into a text file. You can specify the delimiter to use in the call to Export.

View member feedback to this tip.

This code allows you to export information from a view into a text file. You can specify the delimiter to use in the call to Export.

Code:

Sub Initialize
Dim Session As New NotesSession
Dim CurDB As NotesDatabase
Dim View As NotesView
Dim Doc As NotesDocument
Dim FileNum As Integer

FileNum = Freefile
Open "C:\Export.txt" For Output As FileNum

Set CurDB = Session.CurrentDatabase
Set View = CurDB.GetView("Main")
Set Doc = View.GetFirstDocument

While Not(Doc Is Nothing)
Call Export(FileNum, Doc, ",")
Set Doc = View.GetNextDocument(Doc)
Wend

Close #FileNum
End Sub



Sub Export(FileNum As Integer, CurDoc As NotesDocument, Sep As String)
Dim Values As Variant
Dim Cnt As Integer
Dim ExpStr As String

Values = Doc.ColumnValues

ExpStr = Values(0)

For Cnt = 1 To Ubound(Values)
ExpStr = ExpStr & Sep & Values(Cnt)
Next

Print #FileNum, ExpStr

End Sub


MEMBER FEEDBACK TO THIS TIP

In the export, Subroutine doc. should be replaced by CurDoc. to make it work.!

—Roy J.


Do you have comments of your own? Let us know.


This was first published in November 2000
This Content Component encountered an error

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close