Home > Domino Tips > Developer > Formula > Let users filter any view
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

FORMULA

Let users filter any view


Doug Jamieson
06.01.2004
Rating: -4.36- (out of 5)


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


View member feedback to this tip.

Here's a great little Action (or Agent) that lets a user filter any categorized view based on whichever category they choose. I suggest putting it in a SmartIcon so that it will be available in any database or view. You may want to put it in an action button at the top of certain categorized views. It is super-fast (much like using an embedded single-category view). I have put error handling for everything that I encountered, so the user will always get a friendly message.

The @SetViewInfo function filters a view down to a single category. Calling it with a null value will reset the view to show all categories.

This is helpful because of an ugly side-effect of @SetViewInfo -- filtering is retained even when the user changes to a different view. Sometimes this results in zero documents being shown. Clicking the action button again will show all docs.

By the way, I believe that the column choice does not work in @SetViewInfo( ). In my testing, it only works on the first categorized column.

Code:

REM { --- this action button 
filters a view based on the user's input ---
 };

tmpVName := @Subset( @ViewTitle; -1 );
@If( tmpVName = "";
   @Return( @Prompt( [Ok]; "Warning";
 "This only works when a database
is opened to a view.") );
   @Success );
tmpCol := 1;

REM { produce a list of categories
 from the current view };
tmpList := @Unique( @DbColumn( "":"";
 "":""; tmpVName; tmpCol ) );

REM { handle common errors -- reset 
filtering in an inappropriate view };
warningText := "This action only works 
in a categorized view where the category
is the first column." + @Char(10) +
  "This will not work in a flat view or in a 
view where the first column is not
the category";
@If( @IsText( tmpList[1] );
   @Success;
   @Do( @SetViewInfo( [SetViewFilter]; ""; 
""; 1); @Return( @Prompt(
[Ok]; "Warning"; warningText ) ) ) );

REM { Let the user pick one category };
tmpChoice := @Prompt( [OkCancelCombo];
 "Select a Category for Filter"; "This will f
ilter the view to a single
category." + @Char(13) + "  
 (specify blank for all)";
 ""; "" : tmpList );

REM { reminder: expand the view or it 
may appear empty };
@Command( [ViewExpandAll] ) ;

REM { Set the filter (or clear the filter) };
tmpCName := "sPOAreaName";
@SetViewInfo( [SetViewFilter]; tmpChoice;
 tmpCName; 1 )

MEMBER FEEDBACK TO THIS TIP

I just wanted to point out that @SetViewInfo is not available in R5. The tip does not indicate this fact and it really should mention that. Thanks.

—Christie S.

******************************************

So many of my views are categorized by date, it doesn't work on those. But the few I have by customer name, I thought it worked nicely.

—Leslie M.

********************************

When I use Ctrl+A (Edit -> Select All) I get All Documents selected, even the filtered out ones. Is there any way to get only shown entries selected?

—Marco Crivellari (kri@soluzioni-sw.it)

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Doug Jamieson. Please let others know how useful it is via the rating scale belowtip. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

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.




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



RELATED CONTENT
Formula
View hidden fields on Lotus Notes/Domino forms
Case-insensitive @Unique version combines fields on Lotus Notes forms
Provide rich-text formatting via the Profile document and Formula
Using Formula language code to sort Lotus Notes messages by subject
How to create dynamic JavaScript in Notes Domino without formulas
Formula language button manages Deny Access list searches
Retrieve Lotus Notes names from a nested group using @DBLookup
Create a computed Lotus Notes field to list Personal Address Book names
Show multiple Lotus Notes document fields in a single view column
How to send a document as a link in a Lotus Notes email

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