Manage Learn to apply best practices and optimize your operations.

Select view contents on Web by letter

This easy tip will allow you to set up a Web-based view, which permits users to see all the view contents or just those starting with a certain alpha-numeric character.

View expert feedback to this tip.

This easy tip will allow you to set up a Web-based view, which permits users to see all the view contents or just those starting with a certain alpha-numeric character.

This tip, while very easy to implement, does require a few steps. Done once, however, it takes only a couple of minutes to add to any additional views.

  1. Set up a $$ViewTemplate form, and imbed your "show single category" view (easy instructions in Domino help if you've not done this before).

  2. In order to show the correct category (i.e., a single alpha-numeric character), your "Show single category" formula should be:

    @If(RestrictToCategory = "" ; "All" ;

  3. Add the field "RestrictToCategory" to your $$ViewTemplate form.

    Type: Text, Computed, Hidden
    Formula: RestrictToCategory
    NOTE: The following two steps allow you to copy the entire code between $$ViewTemplate forms and only change the value of these two fields.

  4. Create the field "dbname":

    Type: Text, Computed, Hidden
    Formula: @Subset(@DbName ; -1)

  5. Create the field "ViewName":

    Type: Text, Computed, Hidden
    Formula: "insert name of your view 
    here in quotes"

  6. Create a text list on the $$ViewTemplate form containing the word "ALL" and every letter of the alphabet (separated by a few spaces to make them easier to click on). Select each character and make it a link hotspot with the formula:

    "/" + dbname + "/" + viewname 
    + "?OpenView&RestrictToCategory=All"

    Of course, reset "=All" to "=A", "=B", "=C", etc. as appropriate for each hotspot.

  7. Last step -- add a new first column (categorized) in your view with the column formula:

    @Left(YourFieldNameHere ; 1) : "All"
TIP: In order to have the fields evaluate properly for your users, the items should appear on your form in the following order:

A) Field: dbname
B) Field: ViewName
C) Alphabetical Hotspots
D) Field: RestrictToCategory
E) Imbedded View

What you've done is created a Web-based view that although it opens with no restrictions, users may limit the results to a single category -- which, in this case, is a single letter. If a user only wishes to see the documents starting with the letter "W" they no longer have to scroll through dozens, hundreds or possibly even thousands of documents. Instead, they just click on the "W" in the "header" of your view and just those documents beginning with "W" appear. Remember -- since you've set the "Show single category" formula, your sorting category will be hidden from Web users.

LOOK-NICE TIP #1: To quickly make it look nice, I often imbed this function within a table and set the border thickness to 1.

LOOK-NICE TIP #2: If you don't like the look of table borders on all four sides of your links, try the following line of pass-thru HTML. It places a centered line on your form:

<HR ALIGN="center" SIZE="2" WIDTH="80%">

LOOK NICE TIP #3: If you want to get fancy (and have more time on your hands than I do), you could create GIFs to use as hotspots instead of simple text.

LAST COMMENT: If you think about it, this tip would work for just about any view where the categories are unlikely to change. For example, a graphical or text-based listing of the 50 states could let users start out with all documents, then select just those associated with the state they click on.


A few hints:

You can leave off the RestrictToCategory field and just use the formula "All" in the single category field. RestrictToCategory in the URL is a special instruction to Domino, which overrides the single-category formula, so you don't have to do anything special to get that category displayed.

The computed field dbname formula will only work for databases in the root of the server with no special characters in their filename. Rather than @Subset(@DbName ; -1) I would use @WebDBName (for ND6) or @ReplaceSubstring(@Subset(@DbName ; -1); "":" "; "/":"+") (for R5). The latter works on most database pathnames, but not every conceivable name.

In step 6, rather than adding 27 individual hotspots (or however many), you could use @DbColumn of the view, together with some pass-thru HTML computed text, to automatically add a link for each category. The computed text formula follows:

t := @DbColumn(""; ""; "SpecialCat"; 1); 
@If(@IsError(t); @Return(""); ""); 
links := "<TD><a href="/" + 
dbname + "/" + viewname + 
"? OpenView&RestrictToCategory=" + @URLEncode("Domino"; t) + ""> " + t + " </a></TD>"; "[<TABLE bgcolor=#d0d0d0><TR>" + @Implode(links; "") +

Note that this will work for any categorized view, and will list whatever categories appear in that view. The performance is not quite as good, but it's less work. To avoid the @DbLookup and put in a preset list of values, you could just replace the first two lines with:

t := @Explode("All,AL,AK,AS,AZ,AR,
CA,...WV,WI,WY"); REM "list of all state abbreviations"; 

Having a view where each document appears in two categories is unnecessary if you already have a view that displays all the documents uncategorized. Since you're redrawing the whole page anyway, you could just as well use a different view for the All link than the other links.

Do you have comments of your own? Let us know.

Dig Deeper on Lotus Notes Domino Formula Language

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials'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 ...