Notes View on the Web

This code will read a view and write selected fields out as a text file on the server then attach the file to a

document while working from the Web. This allows users working from the Internet to download the attached text file and import it into a non-Lotus Notes product.


Sub Initialize
Dim Session As New NotesSession
Dim db As NotesDatabase
Dim View As NotesView
Dim rtitem As Variant
Dim plainText(4) As Variant
Dim fileNum As Integer
Dim item As NotesItem
Dim doc As NotesDocument
Dim rtitem1 As NotesRichTextItem
Dim object As NotesEmbeddedObject

Set db = Session.CurrentDatabase
Set View = db.GetView("AttendeesXL")
Set doc = View.GetFirstDocument

'declare file for output
fileNum = Freefile
Open "C:\NotesData.TXT" For Output As fileNum

'Loop through the view
While Not(doc Is Nothing)
Set doc2 = View.GetNextDocument(doc)

Set item = doc.GetFirstItem("lname")
plainText(1) = item.Text
Set item = doc.GetFirstItem("name")
plainText(2) = item.Text
Set item = doc.GetFirstItem("rank")
plainText(3) = item.Text

Write #fileNum, plainText(1), plainText(2), plainText(3)
Set doc = doc2
Wend
Close #fileNum

'The following imports the text file and attach to a document
Set doc = New NotesDocument(db)
Set rtitem1 = New NotesRichTextItem(doc, "BodyAtt")
Set object = rtitem1.Embedobject(EMBED_ATTACHMENT, "" , "C:\NotesData.TXT")

doc.Form = "DataTrForm"
Call doc.Save(True, True)

Print"[/DataTrView?OpenView]"

End Sub

This was first published in November 2000

Dig deeper on Domino Resources - Part 2

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:

SearchWinIT

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

SearchVirtualDataCentre.co.UK

Close