Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

From A to Z: Creating an alphabetical navigation bar

Peter Greaves is a Portal and Collaborative Services architect with IBM Software Services for Lotus. From a background as a Lotus Principal Developer and J2EE Portal team lead, he has been working since 2000 to help clients to implement and capitalize on WebSphere Portal and other Lotus technologies in a variety of technical design, development, and architectural roles. You can contact Peter at pgreaves@uk.ibm.com.

Summary:  This tip shows how to create an alphabetical navigation bar for Web applications. This allows you to click the letter C, for example, and go directly to people with a last name that begins with C. (Downloadable example database included.)

Date:  01 Jul 1999
Level:  Introductory

Activity:  2063 views
Comments:  

Many Domino views present documents in alphabetical order. When you look at these databases in a Web browser, you may want to provide a navigation bar with the letters of the alphabet on it. This allows you to click the letter "C," for example, and go directly to documents created by people with a last name that begins with "C." This tip shows you how to create an alphabetical navigation bar for your Web applications.

Downloading the sample database

If you want to follow along with the example shown in this tip, you can download the self-extracting sample database (35KB) from the Sandbox.


Basic approach for creating an alphabetical navigation bar

The sample database contains meeting documents, alphabetically organized by the last name of the person who the meeting is with. The Meetings view appears in a Web browser as follows, with an alphabetical navigation bar at the bottom of the screen:


Figure 1. Meetings view
Meetings view

The navigation bar only displays letters for documents that exist. For example, since no meeting documents exist containing someone with a last name that begins with "B," the letter "B" does not appear in the navigation bar.

To create this type of navigation bar:

  1. Create the form to display your Web application. In the sample database, we chose to create a $$ViewTemplateDefault form.
  2. On this form, create a hotspot that displays computed text. In the sample database, we placed the following Pass-Thru HTML on the form (beginning both sections of code with a left square bracket "["):

    <TABLE border=0 cellspacing=0 width="602">
    	<TR><TD bgcolor="#f0f0f0" colspan=3>
    		<TABLE border=0 width="100%">
    			<TR><td width=20%>
    			<Div align=left>Back</DIV>
    			</TD>
    		<TD width=60% align=center>
    			<p class=tableheader>Meetings</p></TD>
    		<TD width=20%>
    			<DIV align=right>Forward</DIV>
    		</TD></TR>
    		</TABLE>
    	</TD></TR>
    	<TR valign =top><td bgcolor="#f0f0f0" width=1>&nbsp;</TD>
    	<TD width=100%>]
    	
    	</TD><td bgcolor="#f0f0f0" width=1>&nbsp;</TD></TR>
    	<TR><TD 	align=center colspan=3 bgcolor="#f0f0f0">
    		<TABLE border=0 width="100%">
    			<TR><td width=20%></TD>
    			<TD width=60% align=center>
    			<Computed Value>	</A><BR>
    			</TD>
    			<TD width=20%></TD></TR>
    			</TABLE></Center>
    		</TD> </TR> 
    	</TABLE>



  3. Select the tag <Computed Value> (shown in bold above) and choose Create - Hotspot - Formula Pop-up. We don't create constant links here, because we only want to display the letters on the navigation bar that actually have documents listed under that letter. Also, since the code is on a $$ViewTemplateDefault form, we need to calculate the view name because the application uses this form for any views that don't have their own "private" $$ViewTemplateDefault form.
  4. Now, write the formula for the hotspot, which displays the navigation bar. This formula first retrieves the current view name, and then includes any extra arguments that you want as a string constant: vn:=@Subset(@ViewTitle;-1); vwsrc:=vn+"?openview&count=12&collapseView&StartKey=";
  5. Next, create a hidden, categorized view that helps you retrieve the letters that have documents associated with them. In the sample database, we called this view (lkView). To categorize documents based on the first letter of the user's last name, use the following formula in the view's column: lastname:=@Word(mName;" ";2);

    @Left(lastName;1)
    As you can see in the following screen, our hidden view (lkView) contains the letters "A", "D", "G", "J", and "S."

    Figure 2. Hidden view
    Hidden view
  6. Now, add a column as the first column in your "real" view. Use the same formula as the one in the column of the hidden view, (lkView). Make sure this column is sorted and hidden. Adding this column ensures that the StartKey argument works.
  7. Back in the hotspot formula in the $$ViewTemplateDefault form, add the following line of code to retrieve the letters listed in the (lkView):

    lkview:="clAll";

  8. To retrieve a multivalue field, do an @DbColumn on your lookup view by adding this code:

    s1:=@UpperCase(@DbColumn("":"";"":"";lkview;1));

  9. Add the first bit of the HTML for the HREF to the code:

    s2:="<A HREF="+vwsrc + s1+">"+ s1;

  10. Lastly, turn it into a string by using the end of the HTML tag as the separator (notice the space after the </A> tag):

    @Implode(s2; "</A> ")

That's all there is to it. Run your application in a Web browser and see how great it looks!


About the author

Peter Greaves is a Portal and Collaborative Services architect with IBM Software Services for Lotus. From a background as a Lotus Principal Developer and J2EE Portal team lead, he has been working since 2000 to help clients to implement and capitalize on WebSphere Portal and other Lotus technologies in a variety of technical design, development, and architectural roles. You can contact Peter at pgreaves@uk.ibm.com.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Lotus
ArticleID=12816
ArticleTitle=From A to Z: Creating an alphabetical navigation bar
publish-date=07011999
author1-email=
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers