Record Selection

Seagate Crystal Reports allows you to limit or restrict the records that are to be included in a report. In this section you will learn how to:

For example, it may be useful to have a customer list that only lists customers from the USA. The sample data contains records from the United States and International customers. It is easy to restrict lists like this using the Select Expert. See Record Selection.

Entering the selection criteria

When you scroll through the report, you will see that it contains information for customers from many different countries. In this step, you will limit the number of countries displayed to the USA.

To enter selection criteria
  1. To begin, click the Design tab to return to design mode.
  2. Click an empty area of the report to make sure all fields are deselected.
  3. Click Select Expert on the Standard toolbar.

    The Choose Field dialog box appears.

    This dialog box lists all the fields currently in the report in the Report Fields section and then lists all fields that are available from each table in the database fields section.

  4. Since you are going to base record selection on the country field, highlight {Customer.Country} in the Fields list and click OK.

    The Select Expert appears.

    Imagine that you are completing the following sentence:

Select all records where a customer's country is

You complete the sentence with the condition you want the program to use when selecting records for your report. Right now the condition is any value, which implies there is no restriction on the record selection.

  1. Click the arrow on the operators box to see what other options you have. Since you want only those records where the Country is USA, select the is equal to condition.

    A new box appears on the right. The dialog box sentence now reads:

Select all records where a customer's country is equal to

All that you need to complete the sentence is the value USA.

  1. Click the arrow on the empty list. A list of all the country values appears. Select USA from the list.

    The sentence now reads:

Select all records where a customer's country is equal to USA

  1. Click OK to return to the Design tab.
  2. Click the Preview tab to review the results of your work.

    The Change in Record Selection Formula Detected dialog box appears.

  3. Click Refresh Data.
  4. Save this version of the report without overwriting the original report by choosing Save As from the File menu and giving the new report the name USA.rpt.

Congratulations! You have started formatting your report and have added selection criteria to it. More than that, you have learned how to manipulate your data. By now, you have a good idea of the powerful kinds of reports you can prepare.

Deleting a field

Now that the report contains only records from the USA, displaying the Country field in the body of the report is not necessary. You can delete this field before continuing.

To delete a field
  1. Select the Country field and the Country column heading using the Ctrl-click combination.
  2. Press Delete on your keyboard.

That is all it takes to delete fields from the report.

The report should now look similar to this:



Seagate Software, Inc.
http://www.seagatesoftware.com
Please send comments to:
techpubs@seagatesoftware.com