The basic element of a Lotus Domino application is a document. It is used to store data. One step farther away from the data is the form. The forms purpose is data entry and document display. One step farther is a view. A view is a list of documents from a Domino database. This list can be sorted and categorized using one or more key values. Lotus defines a view as the entry point to the data stored in a Domino database, and I can think of no better definition.
Figure 1 shows a basic sample view displaying only two documents. The documents are listed using a field value, and the view is sorted alphabetically. The user clicks the mouse twice to open and view the contents of the document. The view in Figure 1, unfortunately, is not very user-friendly. I am sure you could think of numerous ways to improve its appearance. In this article, I will introduce the many facets of a view, working toward the goal of designing your own view. A view can be as simple or complex as desired. There are many features at the developers fingertips, and here Ill take a look at some of them.
There are two view styles: calendar and standard outline. Figure 1 displays a basic outline view named Attachments. As you can see, this view contains one column and two documents. The documents are listed from top to bottom with possible categorization and sorting. A calendar view displays documents in the form of a grid. This can show two days, one week, two weeks, or a month at a time. In this article, Ill cover standard outline viewscalendar views will not be covered.
There are two types of views, one with slight variations. A private view is for use only by the creator. For instance, I may create one or more private views in my mail file for viewing my mail in a nonstandard format. The other type of view is shared. In theory, everyone can view a shared or public view. More realistic is the possibility that security will be placed on the view, so that it will be viewable only by a defined group of people within an organization. There are a few variations of the shared view, but I wont cover them in this article.
Another powerful aspect of a view is the flexibility afforded to what is actually displayed in it. Each view contains a selection formula that defines what is displayed. The default selection is all documents from the database. Here is the default selection formula:
Notice the default formula takes advantage of the Notes @formula language. Document attributes can be used in the selection formula. For example, the next formula selects only those documents created with the Midrange form.
Select (FORM = Midrange)
This could be rewritten with an @formula:
Select (@Contains(FORM, Midrange))
Boolean comparisons can be utilized in the selection formula as well. The ampersand (&) is used for logical AND and the pipe (|) represents logical OR. These can be combined with parentheses. Here is a selection formula that displays all documents created with the Midrange or Computing forms, where the name field contains the value Tony. I always use parentheses to guarantee a formula is evaluated in the order expected:
Select (((FORM=Midrange) | (FORM=Computing)) & (@Contains(name,Tony)))
Selection formulae cannot be dynamicthat is, values used in the formula must be known at design time. So, certain @formulae such as @DbLlookup are not permitted. In addition, the use of date-time @formulae is strongly discouraged. The system clock is always ticking, so the contents will always be in flux.
Take a look at the actual placement of data in a view. I have always thought of a view as a variation of a spreadsheet: Both have rows and columns, with data residing in the intersection (cell) of the two. A Domino view can have one or more columns. The number of columns is limited to screen real width.
A column displays one type of information pertaining to the listed document or documents. This can be as simple as the creation date or a field value. The column value can be a data value from the document, an @formula, or a combination of the two. As with selection formulae, certain @formulae are not permitted such as @DbLookup.
Creating a View
The creation of a view in the Domino Designer product is simple. Open your database in design mode, select Views, and use the New View button to create a new view. You can use the Create drop-down menu as well. Figure 2 shows the dialog box that is opened once a new view is created. The dialog box facilitates the assignment of a name; select the type of view from the drop-down list; select where the view appears in the context of other views in the database; enter a selection formula; and, optionally, use another view as a template for your new view.
I enter Midrange for the view title. This is a shared view, and I use the defaults for the rest. I click the OK button, which places the view in the list of views in the database. Double-click on the view to open it in design mode.
Selecting the column accesses a columns data value. In addition, column attributes like color and font are selected by double-clicking the column. Figure 3 displays the design
I assigned to the first column in the view. As you can see, I use a combination of a field value and @formulae for the column value. Additional columns can be added by right- clicking and selecting Insert new column from the pop-up menu, selecting Insert new column from the Create drop-down menu, or by double-clicking to the right of the last column in the view.
Double-clicking on a column header opens its property box. Figure 4 shows the properties box for the column, commonly referred to as an infobox. This box allows the developer to set the column display title, font, and spacing, for example. Open the infobox to the second tab. This allows a column to be designated as sorted or categorized. As you can see in Figure 4, the column is sorted in ascending order.
Views can also contain a hierarchy. This means that documents can appear as children under other documents or a category. Response is a type of document that is specially linked to a parent document. This relationship can be properly displayed in a view and is designated in the view property infobox (similar to that in Figure 4). The view name is designated as well, so it can be easily changed. Also, colors and fonts for rows, column totals, and unread documents can be set.
Folders are similar to a view. Both use columns and rows to display documents contained within them. Folders are also convenient because you can drag documents to them and double-click the folders to see their contents. As a Domino developer, a folder is designed in the same manner as a view. A folder has columns, rows, and selection formulae. A document can appear in multiple views but in only one folder.
I hope this article has given you a clear idea of views, how they are used, and where they live and breathe in the world of Domino. A view is one of the most important and powerful components of Domino. Combine it with robust Domino security, and a view becomes a powerful design element for presenting the right data to the right people at the right time.
Figure 1: A simple outline view shows possible categorization and sorting.
Figure 2: A dialog box is presented when you create a view.
Figure 3: Here, data is being defined for the first column of the view.
Figure 4: The properties dialog of a view column is used to define column attributes and column function.