Working with Views

Views are used to organize and display a collection of related data records in a series of rows and columns similar to a spreadsheet. Using a selection formula, Lotus Notes determines which documents are displayed in the view. All documents that meet the selection criteria rule or rules are subsequently included when the view is opened. Every Notes database must have at least one view.

There are two methods for specifying a selection formulasimple action and Formula Language. Using simple actions, you can build a selection formula using a wizard. Alternatively, you can use Formula Language to create more advanced or complex rules for the view.

Let's say, for instance, that you have a database with multiple forms. Using views, you could create a separate view for each form. To ensure that each view only displays the related documents, a unique selection formula is specified for each view. In this case, the selection criteria for one of the views would look something like

SELECT Form = "Reservation";

where "Reservation" is one of the forms in the database.

Note

Use a selection formula or simple action to refine the information displayed in the view. If no formula is specified, all documents will be returned for the view.

In addition to selecting the content for a view, Designer allows you to specify the sort order, column content, and display appearance. Again, using the properties dialog, you can define a sort sequence for each column in the view. Information can be sorted in ascending order, descending order, or not at all.

From an appearance perspective, there are two types of displaysStandard Outline and Calendar. The Standard Outline view displays information in rows and columns. A Calendar view, on the other hand, changes the user interface into a calendar where the documents display based on a specific date and time. Both display documents based on a selection formula.

For example, Figure 4.27 illustrates three different Standard Outline views. Each view contains the same information, simply sorted differently. The views could also be modified to include or exclude fields by changing what's displayed in the columns. In the first example, all of the documents are sorted by First Name and Lastname.

Figure 4.27. Example view sorted by Name

In Figure 4.28, all of the documents are sorted by the Record Number. In many applications, a unique document number is assigned to each record in the database. This view permits users to quickly locate a document based on the document identifier.

Figure 4.28. Example view sorted by Record Number

In Figure 4.29, information is grouped based on a particular fieldthe document Status. This is called a "categorized" view. In this view, all documents that have the same status are grouped together and displayed under the green trianglecalled a twistie, as mentioned earlier.

Figure 4.29. Example view categorized by Status

Tip

The small green triangle, located to the left of each of the three status values (refer to Figure 4.29), is called a twistie. The twistie can be displayed or hidden by setting a checkbox in the view properties dialog.

Finally, Figure 4.30 depicts a Calendar view. To display documents on a Calendar view, the document must contain a date and duration, and the first two columns in the view must contain the start date and duration in minutes (which can be zero). See Chapter 8, "Calendar Applications," for detailed instructions for building a calendar application.

Figure 4.30. Sample Calendar view

Tip

Designer allows you to sort multiple data columns in a view. Columns are sorted from left to right in the view with the data being displayed in either ascending or descending order.

 

Hidden Views

Views are typically used to display information to the users. However, views can also be used to manage the application. In many cases, programming-related views are hidden from the end-user to simplify the overall navigation of the Notes database. In many cases, hidden views are used to provide values for keyword fields or for calculations.

For example, let's say you want to assign a unique, sequential tracking number for each new document added to the database. Any time a user creates a new document, Lotus Notes increments the current tracking number by one and assigns it to the document.

This could be achieved by using a view that contains one column, "Tracking Number," sorted in descending order. As new documents are created, the application retrieves the first record in the view (e.g., the top-most number) and increments the number. As soon as the document is saved, the new document becomes the top-most record in the view. Functionally, the view could be displayed or hidden. However, because users probably will find little benefit from a view that only contains numbers, you could hide it and reduce the number of views displayed to the end-user.

Tip

Hidden views can be displayed in the application by holding down both the Control and Shift keys while opening (or double-clicking on) the database icon. If navigators or outlines are used, then select the View > Go to menu options to display the view.

To hide a view, add the open and close parentheses "( )" when specifying the view name. For example, "TrackingNo" would be visible to the user, whereas "(TrackingNo)" would be hidden.

Creating a Standard Outline View

Follow these instructions to create a standard outline view.

1.

From the menu bar, select Create > Design > View to create a new view. Alternatively, navigate to the View section of the Design pane and click New View. A Create View dialog box window will now appear.

 

2.

Specify a view name. To hide the view, enclose the view name in parentheses. In most cases, you'll want to keep the View type as Shared. This will enable the general user community to access the view. To create a view that only you can access, change this value to Private.

 

   

3.

Next, you can elect to create a blank view or base the design on an existing view in the database. If you have specified a default view, this view will be displayed in the Copy style from view field (see Figure 4.31). Otherwise, the field value will be set to -Blank-. To change this value, click the Copy From button and select a new option.

 

Figure 4.31. Create View dialog

 

4.

Now specify the selection conditions for the view. At this point, you have three options available to youuse the wizard, specify a formula, or leave the field blank. To add a query or set of rules using the wizard, click the Add Condition button and complete the form. Alternatively, click the By Formula radio button to create rules using Formula Language. If no conditions are specified, the view will automatically display all documents stored in the database.

 

Tip

The selection conditions for the view can be changed at any time. If you're not sure what the formula should be when creating the view, you can omit the conditions and specify them later. To set or change the conditions, select the View Selection object in the Object pane in the Designer client.

5.

Click Save and Customize to create the view and open it in the Domino Designer Work pane.

 

   

6.

To add columns to the view, select Create>Insert New Column orAppend New Column. This will add a column to the view. To define the value of the column, locate the Column Value pane and specify a value. Here you can select a simple function (which contains a list of predefined formula values), change the display type to Field and select a field from the list of values, or use a Formula to determine the column contents.

 

7.

Finally, to set the sort order, click on the column header and select Edit > Properties. Click on the second tab to change the sort preferences or to create a categorized view.

 

Creating a Calendar View

Follow these instructions to create a calendar view.

1.

From the menu bar, select Create > Design > View to create a new view. Alternatively, navigate to the View section of the Design pane and click New View. A Create View dialog box window will now display.

 

2.

Specify a view name.

 

3.

Next, click the Copy style from view button and set the value to -Blank- if not already set to this option.

 

4.

Now specify the selection conditions for the view. At this point, you have three options available to youuse the wizard, specify a formula, or leave the field blank. To create a rule or set of rules using the Designer wizard, click the Add Condition button and complete the form. Alternatively, click the By Formula checkbox to create rules using Formula Language. If no conditions are specified, the view will automatically display all documents stored in the database.

 

5.

Click OK to build the view.

 

6.

Locate the view in the Design pane and open the view. Select Edit > Properties and change the Style from Standard Outline to Calendar. By default, Designer will display a warning message "Changing to a calendar view may change the attributes of this view. Continue?" Click Yes and close the properties window.

 

7.

The first column in the view must contain a date/time field value. Change the sort order to ascending. Depending on the application, you may want to hide this column using the properties dialog.

 

8.

The second column in the view must contain the duration field value or a hard-coded value of zero. In most cases, you will want to hide this column using the properties dialog.

 

Note

The calendar view will not display if the first and second columns do not respectively contain a date/time and duration value.

Working with Application Menus

Категории