| Date tip published: | 12/01/2002 |
| Description: | R5 introduced the ability to display a single category for an embedded view. With Notes Domino 6 there is a new @function to filter a view to show the documents of a specified category. The view does not have to be embedded and this @function will work from a view action or in the PostOpen event for the view. |
To learn more about the many new enhancements to Release 6 and how to get re-certified as a Release 6 CLP use the following link:
Notes Domino 6 Application Development Update
Filter a view
The new @SetViewInfo function can be used to filter a view to show the documents of a specified category.
The syntax of this @function is:
@SetViewInfo( [SETVIEWFILTER] ; filterString ; columnName ; isCategory )
filterString - Text. Serves as the key to determine which documents display in a view. If this string is present in the column specified in columnName, includes the document in the view.
columnName - Text. The programmatic name of a column. The column specified here must contain the filterString for the document to display in the view.
isCategory - Number. Boolean value. Required in a Standard Outline view; not for use in Calendar views. 1 indicates that the column in the columnName value is a category, 0 indicates that it is not.
TLCC Observations
TLCC discovered the following when testing this @function:
- The filterString parameter does not have to be an exact match. It will look for the filterString in any part of the view column.
- The final parameter, isCategory must be 1. Since @SetViewInfo only works on categorized views it is unclear why this parameter is even present. Perhaps later releases of Notes Domino 6 will implement this feature for non-categorized views, but for now the column used to filter the view has to be categorized.
- This @function does not work in web browsers.
|
Example of @SetViewInfo
The following screen sequence shows how the @SetViewInfo function can be used to filter a view to show the documents of a specified category.
- The view in this image shows product orders categorized by customer name. Note the product order documents for the Fox Run Golf Course customer.
- The following dialog is displayed when the [Filter the view] action button is clicked. The selected customer is passed as the filterString argument to the @SetViewInfo function.

- When "Fox Run Golf Course" is chosen in the dialog, the view is filtered to display only the documents in the "Fox Run Golf Course" category.

Technique - Using @SetViewInfo
The formula in the [Filter the view] action is:
| 1. listofnames:=@DbColumn("";@DbName;"SalesOrdersByCustomer";1); |
| 2. custname:=@Prompt([OkCancelList];"Pick a name"; "Pick a customer name to filter the view on";listofnames[1];listofnames); |
| 3. @SetViewInfo([SetViewFilter];custname;"Customer";1) |
Line 1 gets a list of all the customers in the view.
Line 2 prompts the user to select a customer from the customer list.
Line 3 uses the @SetViewInfo to filter the view using the "Customer" column. This is the column with the name of "Customer" (as set in the column properties, advanced tab.) The view is filtered using the customer name chosen in the @prompt.
To reset the view just use a null string for the filterString:
| @SetViewInfo([SetViewFilter];"";"Customer";1) |
Notes Demonstration
To test the @SetViewInfo function, download this database to your Notes 6 data directory and open it using Notes 6:
To learn more about the many new features of Notes Domino 6 check out TLCC's Notes Domino 6 Application Development Update course.
|