Creating a Single Filter


The Select Expert allows you to define the filter that allows certain types of data to display within your report. This functionality is carried out through a selection statement, which is a formula that specifies the records or group of records that you want included within your report.

Selection statements are actually formulas written in the SQL language. What the Select Expert does is take the legwork (and headaches) out of writing these formulas.

To access the Select Expert and begin learning about filtering, let's create a new report.

  1. In the Select Expert, press the drop-arrow to open the Comparison Operator list.

    You screen should look like Figure 7-4.

    click to expand
    Figure 7-4: The Comparision Operator list

  2. Set the Comparison Operator option to Is Equal To.

    When you select this value, a new drop-down field displays to the right. This new drop-down field allows you to define a comparison value.

  3. Select the Comparison Value drop-down field.

    Click the down arrow in the right drop-down field. Select TX for Texas. You can type in TX, but make sure not to use quotation marks. Your screen should look like Figure 7-5.

    click to expand
    Figure 7-5: The Comparison Value field

    Caution

    Databases are nitpicky when it comes to database values. A comparison value must appear exactly as it is in your report. You're usually safest choosing from the drop-down list (since these values are pulled directly from your database).

    Unfortunately, these values do not always contain the comparison values you may need. If you do type in a value, make sure it exists within the database. Use the Browse button to view the values in the database.

  4. Press the OK button.

    A message box asks if you wish to either use saved data or refresh your data.

  5. Select the Refresh Data button.

    Your report refreshes, and you're returned to the Report Design area. Scroll through your pages.

Tip

By default, Crystal Reports saves records with a report the first time you preview a report. Working with saved data allows you to work with a report without constantly having to wait around for your report to refresh data from the server. Using saved data is a good idea when you're making simple formatting changes or modifying areas of the report that don't require the data to be refreshed.

However, if you're changing selection statement criteria (i.e., making changes within the Select Expert), it's a good idea to always refresh your report. Not doing so might result in your report showing too few records, even though they actually exist.

If you accidentally press the Saved Data button and your report doesn't return any records, press the F5 key (or Report, Refresh Report Data from the menu bar).

You've successfully created a selection statement within your report. You should only see customers with a region equal to TX, as shown in Figure 7-6.

click to expand
Figure 7-6: A report with a single filter

Removing Selection Statements

So what do you do if you wish to remove a selection statement? Crystal Reports makes removing your filters just as easy as adding them. To remove a selection statement, try the following. Use the report that you've been working on in this chapter.

  1. Access the Select Expert.

  2. Select the tab that contains the Region filter.

  3. Press the Delete button on the Select Expert dialog box.

    That particular filter is now removed.

  4. Press the OK button on the Select Expert dialog box.

    Crystal Reports asks if you'd like to refresh your data.

  5. Press the Refresh Data button.

    You're returned to the Report Design area.

  6. Preview your report.

Notice that Crystal Reports removes the region filter from your report. Thus, customer information from all regions now displays.




Mastering Business Analysis with Crystal Reports 9
Mastering Business Analysis with Crystal Reports 9 (Wordware Applications Library)
ISBN: 1556222939
EAN: 2147483647
Year: 2004
Pages: 177
Authors: Chris Tull

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net