Manage Learn to apply best practices and optimize your operations.

Let users filter any view

Here's a great little Action (or Agent) that lets a user filter any categorized view based on whichever category they choose.

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.


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] );
   @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 )


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 (

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

This tip was submitted to the 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.

Dig Deeper on Lotus Notes Domino Formula Language



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury