Sams Teach Yourself StarOffice® 5 for Linux in 24 Hours

ContentsIndex

Hour 18: Using Database Functions

Previous HourNext Hour

Sections in this Hour:

 

Sorting Database Records


Another of the truly useful database features in StarOffice is the capability to sort lines of information.

You can choose which field to sort on, and set other sorting options to fit your data arrangement.

The same sample list of names and addresses is used to show how sorting works.

Selecting Data to Sort

The first step in sorting data is selecting the area that you want to sort. This area consists of a block of cells, including the field names at the top of the block. Figure 18.8 shows the selected cells that you want to sort.

Remember these two dangers as you select the area to be sorted:

After you have selected the cells to be sorted, choose Sort... from the Data menu. The Sort dialog box appears (see Figure 18.9).

Figure 18.8
The full table, with field names, is selected for the sort operation.

Figure 18.9
The Sort dialog box enables you to choose options for how a block of records is sorted.

Setting the Sort Criteria

The method used to sort a list of records in StarOffice is based on two things:

The first field in the Sort dialog box is Sort by. Click on the drop-down list and notice that it contains the names of the fields from your sample data. It's a good idea to include the field names in the block of cells that you select for sorting.

Tip - The field that you sort on is sometimes called the sorting KEY.


Suppose that you want the list sorted by state, and then alphabetically within each state. Follow these steps:

1. From the Sort by drop-down list, select State. (If you're using different sample data, the items in the list are different.)

2. Choose the Ascending button (so that AL is listed first and WY last).

3. Now that the first Sort by field is defined, you can select a second field from the next field down, labeled Then by. Choose Name from this drop-down list.

4. Also choose the Ascending button next to this field (so that Allan is listed first and Zoe last).

With the sort criteria set, you can choose OK, and the records are sorted.

Reviewing Sorting Options

Sorting in StarOffice provides many other options, however, in addition to setting up the sort criteria.

Select a block of cells and choose Sort from the Data menu. Then choose the Options tab (see Figure 18.10).

The following sections describe each of the items in the Options tab:

Figure 18.10
The Sort dialog box includes an Options tab in which you can set up many variations in how StarOffice sorts records in your tables.

Note - You can uncheck this box and choose the Sort Criteria tab to see that the drop-down list contents change to Column B, Column C, and so on.


Sams Teach Yourself StarOffice® 5 for Linux in 24 Hours

ContentsIndex

Hour 18: Using Database Functions

Previous HourNext Hour

Sections in this Hour: