Filter a Notes View for a Subset of Documents

Mindwatering Incorporated

Author: Tripp W Black

Created: 08/03/2009 at 02:37 PM

 

Category:
Notes Developer Tips
Formulas, Views

Issue:
Need a simply way to perform a search or do a filter on a Notes view, using the Notes Client, and display the results:

Solution:
An example solution to filter a view by user name:

Button to perform search:
@SetTargetFrame("MyViewFrame");
@Command([OpenView]; "MyView");
@SetViewInfo([SetViewFilter]; @Name([CN];@UserName); "UserName"; 1);

Button to reset view:
@SetTargetFrame("MyViewFrame");
@Command([OpenView]; @Subset(@ViewTitle; -1));
@UpdateFormulaContext;
@SetViewInfo([SetViewFilter];"" ; "UserName"; 1);

Note: The key functions are the @SetViewInfo & @UpdateFormulaContext formula commands.

Solution:
A meta-script alternative that simulates a search onto a new document:

1. Create a new document w/SaveOptions="0"
2. Do a db.Search and get resulting collection.
3. Populate Body field of report document by looping through results with either:
a. Printed newsletter type with doclinks to each document.
or
b. URL links where the url starts w/ notes://.
(Latter is my preferred as whole line can be linked. The notes;// URL works well on Windows machines. Have not tested this on Mac or Linux workstations.)
4. Do w.EditDocument to present document to user.
5. Give user Close button to close the form tab.

Note: You can also put the search field on the form and replace the report body field and re-present the form to the user with the links to the docs.

previous page