Manage Learn to apply best practices and optimize your operations.

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 := 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 last published in November 2000

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchDataCenter

SearchExchange

SearchContentManagement

Close