The following LotusScript agent creates a view for browser users using
alternating row colors, a function not provided by the Domino model. This
particular example only loops through one view and prints a two column table
with the field values. This agent is very scalable and can be easily modified
to add some additional options like hypertext links using the doc.UniversalID
method. The key is the Print commands and the combination of HTML and
LotusScript variables. The code resides in an agent that is set to "Run Once".
Sub Initialize
Dim session As New NotesSession, db As NotesDatabase, view As NotesView
Dim doc As NotesDocument, doc2 As NotesDocument, bgcolor As String
Set db = session.CurrentDatabase
Set view=db.GetView("Time per Step")
Set doc = session.DocumentContext
'****** the following line starts the HTML and sets text color and document
background color
Print {<html><body text="black" bgcolor="white">}
'****** additional HTML could be added here for a header
'****** the next line creates the table for the data and sets the column labels
'****** to add additional column labels add another <TH></TH> with the label
in
between
Print {<Center><Table width=100%><TR><TH>Column 1
Title</TH><TH>Column 2
Title</TH>}
Set
Requires Free Membership to View
Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.
Do While Not (doc2 Is Nothing)
'****** the next line sets the font and the if then else that follows is what
controls the
'****** alternating row colors
fontface = "Helvetica"
If bgcolor = "Silver" Then
bgcolor="White"
Elseif bgcolor="White" Then
bgcolor="Silver"
Else
bgcolor="Silver"
End If
'****** note: all data between <TR></TR> is row data
'****** note: all data between <TD></TD> is cell data
'****** note: add another <TD></TD> within the <TR></TR> to create another
column
'****** the following four lines write one row of data with two columns
Print "<TR VALIGN=BASELINE BGCOLOR=" & bgcolor & "><TD>"
Print "<Font Size=-1 Face=" & fontface & "><B>" & doc2.Requestor(0) &
"</B></TD>"
Print "<TD Align=center>"
Print "<Font Size=-1 Face=" & fontface & "><B>" & doc2.OrderType(0)
& "</B></TD></TR>"
Set doc2 = view.GetNextDocument(doc2)
Loop
Print {</Center></Table>}
End Sub
This was first published in November 2000