Global Variables in Lotus Notes 5 +  Designer

Posted on 2002-07-03
Last Modified: 2013-12-18
I want to design a VIEW, for the web, with alternate row colors. (ex. first blue, second white, and so).
How do I do this?? In Lotus Script??

Question by:mltolun
  • 3
  • 2

Accepted Solution

Arunkumar earned 50 total points
ID: 7127676
Two options, courtesy of Advisor Media (

+ ADVISOR TIP: Add Alternate Row Colors to Web Views
- Domino 5x/4.6 (Issue ELN010212)
Have you ever wanted to use the Alternate Rows color effect
available in Lotus Notes views in Web views?

One way would be to use @DocNumber to identify odd- and even-
numbered rows and change the color accordingly.

However, @DocNumber is special text that can't be used
directly, and can't be converted to a usable number with

Here is a JavaScript example showing how to gain access to
the @DocNumber value, perform a modulo, and change the color
of alternating rows. In the first column of the view, just
put this code in the column's formula.

"SCRIPT>( ("+@DocNumber("") + "%2) == 1)?document.write(\"<TD
BGCOLOR=#FFEFCE>\"):document.write(\"<TD BGCOLOR=#FFFFFF>\"); </SCRIPT>]" +
SomeFieldName + "/TD>]"

--Dan Allensworth, Sheboygan, Wisconsin

Editor's Note: Putting this code into a view column overrides
any formatting Domino would apply to the column, such as font
size and color. It also overrides Domino's ability to display
the column entries as links. Therefore, add your own <FONT>
tags to format "SomeFieldName". And, if you need links in the
column, add your own <A href> tags. Great tip!

+ ADVISOR TIP: Display Web Views with Alternating Row
Colors: Revisited (Issue ELN010423)
- Domino 5x
- Microsoft Internet Explorer 5x/4x

A recent Advisor Tip showed how to create alternate colors
for Web view rows using @DocNumber. Because Domino
increments @DocNumber regardless of whether the user can
see the document, this won't work for documents that contain
Readers fields. Here's an all JavaScript solution that works
for all situations.

In the HEAD part of the $$ViewTemplate form
for your view enter this code:

<SCRIPT TYPE="text/javascript"> var count=0;
//Sets "count" to be a global variable. </SCRIPT>

I use a StyleSheet to control the colors of my
alternate rows. The StyleSheet could look like this:

background-color: #FFFFFF;
background-color: #CCCCCC;

In the first column of the view:

"<SCRIPT> var color; if(count%2){ document.write
(\'<TR CLASS=Odd>\'); } else{ document.write
(\'<TR CLASS=Even>\'); };count++</SCRIPT>"

The rest of your columns can be whatever you want
to display. I also set "Treat document contents
as HTML" for the form and "Treat view contents as
HTML" for the view.

--Joacim Boive



Expert Comment

ID: 7127679
Alternate row color for web views - Easy solution
Posted by David Frahm on 19.Mar.01 at 10:48 AM using a Web browser
Category: Domino Designer -- ViewsRelease: All ReleasesPlatform: All Platforms
I've seen a lot of examples on how to get this to work, since the regular Notes view property doesn't work on the web, just in the Notes client. However, they were all too complicated and some required that the view property "Treat view contents as HTML" to be enabled.

Below is my attempt to devise a simple, easy-to-implement solution. It works whether the view is categorized or not. As a bonus, it also changes the column header cells to have a gray background just like in the Notes client.

On the $$ViewTemplateDefault form, place the following code in the JS Header section:
function transformView() {
var tableElements = document.getElementsByTagName('table') ;
// alert('tableElements.length = ' + tableElements.length) ;
var table = tableElements[tableElements.length - 1] ; // change this value if the view table is not the last table on the page, this varies depending on how you layout your $$ViewTemplateDefault form
// table.width = '100%' ; // spreads out the table if you want it to
table.cellSpacing = '0' ; // removes space between cells

headers = table.getElementsByTagName("th") ;
for( i = 0; i < headers.length; i++) {
headers[i].bgColor = '#cccccc' ;

rows = table.getElementsByTagName("tr") ;
var counter = 0
for( i = 0; i < rows.length; i++) {
rows[i].bgColor = (i % 2 ? '#efefef' : '') ;


Also, you must call the above function by placing the following code into the HTML Head Content section:

This does not work if the view is categorized and has the View > Style property lines per row set to anything other than 1.

The example above is for R5 but could easily work in R4 by utilizing the appropriate $$ fields (which I don't remember because its been too long :-)).

By the way, if you have trouble with the column headings not aligning correctly with the column contents, this is corrected by disabling the View > Options property "Show response documents in a hierarchy". This should only be needed when there are no response documents in the view, so disabling the property in order to fix the display should not cause any problems.
LVL 10

Expert Comment

ID: 7127722
And here my two pence:)

Place this in first column that should alternate:
"[</td></tr><SCRIPT>(("+@DocNumber("") + "%2) == 1)?document.write(\"<TR BGCOLOR=#FFEFCE><td colspan=3>\"):document.write(\"<TR><td colspan=3>\");</SCRIPT>]"+SomeFieldName


Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.


Author Comment

ID: 7127974
It's ok...just ok

Expert Comment

ID: 7128278
But a "B" is not okay for me you see ???

Hi Zvonko!
LVL 10

Expert Comment

ID: 7129202
(Hi Bro :)

Hello mltolun,

it is obvious that your question title and question body do not match together. And your feedback make this confusion complete.
The work Arun and I invested to provide a solution for you should be at least worth some kind words.
And when you are grading keep in mind that this gradings are multiplications for our expert points. This is not a big problem for us but for you when you again have such a confuse question :)

This what I just said to you can be read following the link below about Comments&Answers.

'till next time,


Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question