Manage Learn to apply best practices and optimize your operations.

Alternating Row Colors For Web View

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 {&LThtml>&LTbody 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 &LTTH></TH> with the label in
between
Print {&LTCenter>&LTTable width=100%>&LTTR>&LTTH>Column 1 Title</TH>&LTTH>Column 2
Title</TH>}
Set doc2 = view.GetFirstDocument
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 &LTTR></TR> is row data
'****** note: all data between &LTTD></TD> is cell data
'****** note: add another &LTTD></TD> within the &LTTR></TR> to create another
column
'****** the following four lines write one row of data with two columns
Print "&LTTR VALIGN=BASELINE BGCOLOR=" & bgcolor & ">&LTTD>"
Print "&LTFont Size=-1 Face=" & fontface & ">&LTB>" & doc2.Requestor(0) &
"</B></TD>"
Print "&LTTD Align=center>"
Print "&LTFont Size=-1 Face=" & fontface & ">&LTB>" & doc2.OrderType(0)
& "</B></TD></TR>"
Set doc2 = view.GetNextDocument(doc2)
Loop
Print {</Center></Table>}
End Sub

This was last published in November 2000

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-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 ...

SearchDataCenter

SearchExchange

SearchContentManagement

Close