Sams Teach Yourself StarOffice® 5 for Linux in 24 Hours

ContentsIndex

Hour 18: Using Database Functions

Previous HourNext Hour

Sections in this Hour:

 

Filtering Data Records

The final StarOffice database feature that is described here is data filtering. Data filtering is used to select a subset of records based on a rule.

For example, when you're looking at all the records in your sample data, suppose you want to review all the names from California. You can sort the table and scroll to that point, but sometimes you can't rearrange the table; you'd have to find all the California records manually.

Filtering provides a way to auto-select these records so that you can work on them.

StarOffice provides an automatic filter that examines all values in the table, or you can enter the specific values that you want to filter for viewing.

Tip - Filtering is a feature that you turn on to work with certain records, and then turn off to view the entire table again. Be sure to save your spreadsheet after you complete your edits!

Using Automatic Filtering

Using the sample data from the previous examples, you can select Filter from the Data menu, and then select AutoFilter from the Filter submenu. AutoFiltering is turned on, and the filtering drop-down lists appear at the top of your columns of data for each field (see Figure 18.11).

To select all the records from California, click on the drop-down list on the State field, and select CA (see Figure 18.12).

Figure 18.11
By turning on AutoFiltering, you can select a filtering criteria from the drop-down lists.

Figure 18.12
Select a value (such as CA) from the drop-down list to see only records that match that value for that field.

The records that are displayed are those that have CA in the State field (see Figure 18.13).

Figure 18.13
AutoFiltering makes it easy to view only the records that match a selected value for a certain field.

With the California records showing, you can easily review or edit them as a group. Notice that the row numbers shown match the true row numbers in the unfiltered spreadsheet.

When you're done working with the California records, select Filter from the Data menu, and then uncheck AutoFilter by selecting it again from the Filter submenu. All the records in the table are displayed again.

Using the Standard Filter

You can also define filter criteria yourself. This can save time if you have a field that contains many types of data.

For example, if you have hundreds of records for California, and you only want to view those that are in Fairfield, you can use a Standard filter to set both City and State criteria at the same time. The AutoFilter doesn't allow this flexibility.

To set a Standard filter, select Filter from the Data menu, and then choose Standard filter from the Filter submenu. The Standard Filter dialog box appears (see Figure 18.14).

Figure 18.14
The Standard filter dialog box can be used to select multiple values on which records are to be filtered.

You can choose up to three fields to filter. This is similar to choosing three fields to sort, except that with filtering, only records matching a certain value are displayed.

For example, you can choose State as the Field name, equals (=) as the Condition, and CA as the Value.

Then you choose an Operator to define the interaction between the multiple criteria. Choose AND from the drop-down list.

Next choose City as the field value, greater than or equal to (>=) as the Condition, and a city name near the middle of the alphabet as the Value.

The dialog box with your selections appears in Figure 18.15.

After choosing OK to apply the Standard filter, the list of records looks similar to Figure 18.16. Notice that only California records with names greater (later in the alphabet) than your criteria are listed.

Figure 18.15
The Standard Filter dialog box with field names and values chosen.

Figure 18.16
Records selected with a standard filter are shown without the drop-down lists at the top of each column.

Notice also that the field names at the top of the columns do not have drop-down lists. To alter the filtering, you must go back to the Standard filter dialog box.

After you've finished editing the filtered records, you can remove the filter so that all the records are displayed. To do this, open the Standard filter dialog box and select none from the Field name list. All the filtering fields are cleared. When you choose OK, all the records are displayed.

Sams Teach Yourself StarOffice® 5 for Linux in 24 Hours

ContentsIndex

Hour 18: Using Database Functions

Previous HourNext Hour

Sections in this Hour: