Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Global Variables in Lotus Notes 5 +  Designer

Posted on 2002-07-03
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Accepted Solution

Arunkumar earned 150 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


Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

688 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