Home > Domino Tips > Developer > Domino > Select view contents on Web by letter
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

DOMINO

Select view contents on Web by letter


Andy Foshee
07.03.2003
Rating: -3.14- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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.

Code


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" ;
     RestrictToCategory)

  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.


EXPERT FEEDBACK TO THIS TIP

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; "") +
"</TR></TABLE>]"

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.


Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Domino
Mimic Lotus Notes Domino application functionality on the Web
A single form to view and edit any Lotus Notes document
DECS and DCR external data access considerations
How to create non-scrolling Lotus Domino view headers on the Web
Disabling the 'Submit' button on a form
An easier way to update a rich text field
Results from Default Notes Search have # of responses in brackets
Lotus Notes/Domino veteran offers comprehensive list of app dev tools
Notes to XML. . .and back again
Creating thumbnail images using LS2J in LotusScript

Lotus Notes Domino Formula Language
View hidden fields on Lotus Notes/Domino forms
Case-insensitive @Unique version combines fields on Lotus Notes forms
Do I use Formula or LotusScript to include a doclink to a Notes view?
Top 10 Lotus Notes/Domino coding and development tips of 2008
Provide rich-text formatting via the Profile document and Formula
Top 10 Formula language tips
Using Formula language code to sort Lotus Notes messages by subject
How to create dynamic JavaScript in Notes Domino without formulas
Stop response documents from showing in a Lotus Notes form
Formula language button manages Deny Access list searches

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

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.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts