APPLICATION DESIGN


Sorting documents in views
Most views can benefit from a sorting method that organizes documents in a way that makes sense to users. For example, a By Date view sorts documents by their creation dates, and a By Author view sorts documents by author names. To achieve this effect, designate at least one column as a sorting column. Then define it as a user-sorted column, an auto-sorted column, or both.

Views that display categories often use sorting methods to alphabetize the category names.

Ascending and descending order

Columns sort documents in ascending or descending order:


Character sorting rules

After the ascending or descending order is set, characters are sorted in this order:


Case-sensitive and accent-sensitive sorting rules for Release 5 and greater differ from sorting rules in previous releases in the following ways:
Sorting multiple values

If the sort column displays values from a multiple-value list, select "Show multiple values as separate entries" to show each value as a separate row. If you don't set this option, multiple values display as one entry.

Caution If you set this option on a column that displays a multivalue list, but you do not specify a sort order for the column, IBM® Lotus® Domino(TM) Designer displays only the first value in the list. Also note that setting this option for multiple columns in a view can have a serious performance impact on your application.

Setting this option correctly on a sorted column may still not produce the results you are expecting. In the following example, Julie has created a document with a field containing the items apples and chickens. Bill has created a document with a field containing the items bananas and ducks. When you sort the Entry column in ascending order and specify "Show multiple values as separate entries," the following view results:

Multiple field entries displayed as separate entries in a view column

To list multiple entries from a document together, you must sort a column to the left. In this example, sorting the Author column creates the following display:

Multiple field entries displayed together in a view column

And finally, to streamline the display, you can categorize the Authors column to produce the following:

Multiple field entries categorized in a view column

Displaying a categorized view as flat

If your view is a categorized view built in Designer Release 5.0 or later, you can select "Categorized is flat version 5 or greater" to convert your view to a non-hierarchical, flat view, which displays all documents on a single level. Use this feature if your level of indentation in a view exceeds the limit of 32 levels.

User-sorted columns

Users see a triangle next to a column title whose values can be resorted. Users click the column and choose a sorting method to see the documents in the order they choose.

User-sortable columns in a view

To set up a user-sorted column, select the option "Click on column header to sort" on the Sorting tab of the Column Properties box. Then select Ascending or Descending order, or select Both to allow users to cycle among ascending sort order, descending sort order, and no sort order for the column.

Deferred sort index creation

A view in a Domino application may contain more than one index. These additional indices are created for each possible user-sorted column when the view is built. Since most of these sort indices go unused, creating them with the view is an unnecessary load on a server in terms of I/O, CPU usage, and space.

IBM® Lotus® Notes® Release 8.0 offers an option to defer the creation of these sort indices until they are needed, by a user clicking on the header of a sortable column. To enable this option for a specific sort index, select the option "Defer index creation until first use" under the "Click on column header to sort" option on the Sorting tab of the Column Properties box.

All on-demand sort indices have a life span subject to the view's discard interval. They can also be explicitly removed by issuing this command on the server console: load updall <dbname> -r -g

Auto-sorted columns

To set up automatic sorting, select the option "Sort: Ascending" or "Sort: Descending" on the Sorting tab of the Column Properties box. The sorting column is usually one that appears on the left side of the view.

Multiple sorting columns

To create multiple levels of sorting, designate more than one column as a sorting column. For example, if a primary sorting column sorts entries by date, a secondary sorting column might sort entries by author. Then all documents created by one person on a particular date are grouped together.

Multiple sorting columns in a view

Using an auto-sorted column as the secondary sorting column

To add a secondary sorting column, add a column to the right of the first sorting column and then choose Sort: Ascending or Sort: Descending on the Sorting tab of the Column Properties box. Documents and responses are sorted, then sub-sorted, in column order from left to right.

Designating a secondary sorting column for a user-sorted column

User-sorted columns override the sorting built into auto-sorted primary and secondary columns. If the view has a user-sorted column and you want to include secondary sorting, you can associate it with a secondary sorting column. On the Sorting tab of the Column Properties box for a user-sorted column, click "Secondary sort column" and choose the secondary sort column and its sorting order.