A-Z Links for Domino Views

A-Z Links for Domino Views

A fairly simple way to present a large single view where a user can quickly "jump" to any letter of the alphabet, instead of needing many views to do the same thing. It leverages the ability to use the StartKey parameter in a Domino URL with an agent to determine exactly how many items to display for each letter in the view.
The brackets " [ ] " have been replaced with " { } " as the square brackets were interpreted below as starting and ending real HTML code. To use this tip, replace the curly brackets with square brackets.

Your view needs to have a hidden, sorted first column which contains only the first character of your main field (the Title, perhaps), using a formula like: @UpperCase(@Left(YourFieldName; 1))

Then your A-Z formula could be in a Computed for Display field which could be placed in the $$ViewTemplate for the view. It would look lke this:
list := @DbColumn(""; ""; @ViewTitle; 1)
tlist := @Trim(@Unique(list));
open := "{&LTa href="/" + @ReplaceSubstring(@Subset(@DbName; -1); "\"; "/") +
"/(Categories)?OpenAgent&View=" + @ReplaceSubstring(@ViewTitle"; " "; "+") +
"&Category=";
end1 := "">";
end2 := "</a>}";
All := "{&LTa href="/" + @ReplaceSubstring(@Subset(@DbName; -1); "\"; "/") +
"/" + @ReplaceSubstring(@ViewTitle"; " "; "+") + "?OpenView&count=" +
@Text(@Elements(list)) +"">List All</a>}";
combined :=

    Requires Free Membership to View

    Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

open + tlist + end1 + tlist + end2;
all : combined

This presents a link for each letter of the alphabet contained in the first character of the view's list, preceded by a "List All" link to load the entire view. The "&Count=" in "List All" is calculated in the formula by counting the elements in the @DBColumn. For the other links, parameters are passed to an agent, an then the agent's output re-opens the view with appropriate &StartKey and &Count parameters. In this case the agent is named (Categories), and is Shared, set to Run Once:

Dim s As New notessession
Dim doc As notesdocument
Dim db As notesdatabase
Set doc = s.DocumentContext
Set db = doc.parentdatabase
eval = Evaluate("@right(Query_String; ""&Category="")", doc)
category$ = eval(0)
eval = Evaluate("@middle(Query_String; ""&View=""; ""&"")", doc)
WViewName$ = eval(0)
eval = Evaluate("@ReplaceSubstring(@middle(Query_String; ""&View="";
""&""); ""+""; "" "")", doc)
ViewName$ = eval(0)
Dim view As notesview
Set view = db.getview(Viewname$)
Dim coll As notesdocumentcollection
Set coll = view.GetAlldocumentsByKey(category$, True)
Print "[/" & db.filepath & "/" & WViewName$ & "/" & "?OpenView&StartKey="
& Category$ & "&Count=" & Cstr(coll.count) & "]"

This was first published in November 2000

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.