Mastering Business Analysis with Crystal Reports 9 (Wordware Applications Library)

Many report developers prefer the use of wildcard characters when creating their filters. Wildcard characters are placeholders used to represent one or many characters. Wildcard characters are useful in that they allow you to filter records without having to define too specific of a comparison value.

The two wildcard characters are the asterisk (*) and the question mark (?). The asterisk represents one or more characters, while the question mark represents a single character.

Perhaps the easiest way to understand wildcard characters is to try an example. Continuing where you left off with the example in this chapter, perform the following steps:

  1. Access Report, Select Expert from the menu bar.

    The Select Expert displays. Press the <New> tab. The Choose Field dialog box displays.

  2. Select the Customer Name field from the Customer table.

  3. Press the OK button.

    The Select Expert displays.

  4. In the Comparison Operator drop-down field, select the Is Like operator.

  5. In the Comparison Value drop-down field, type P*.

    Using this wildcard character means that only customers whose name begins with P shall display within your report.

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

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

  7. Press the Refresh Data button.

    You're returned to the Report Design area.

  8. Preview your report.

    Scroll through the pages within your report. You should only see customers whose name begins with P, are within the USA, and whose order dates are greater than or equal to 1/1/2001.

Figure 7-9 displays the results of your work.

Figure 7-9: Creating filters using the wildcard character

You'll find that as you work more with reports, filters play a large part in how meaningful and useful your reports become. You'll get some more practice with creating filters in the report building exercise at the end of Part II.

Категории