Chapter 4 - Selecting Records with Parameters

This chapter first shows you how to filter data using the Select Expert and then shows you how to create advance filters using parameters. Parameters are covered in great detail because they are also used within report formulas and for custom formatting. The effective use of parameters within record selection formulas and custom formatting lets you create dynamic reports that are tailored to each specific user.

Become a Crystal Reports expert with the authoritative resource available. The tuturials and tips in this book will take your skills to the next level.
Buy at

This is an excerpt from the book Crystal Reports Encyclopedia. Click to read more chapter excerpts.

Selecting Records Tutorials

Tutorial 4-1. Selecting Records

Let's put what we learned about selecting records to use. In this tutorial we will set a filter on two fields: Country and Last Year's Sales. For Country we want to select a specific set of countries to print (Canada, England, and USA). For the Last Years Sales field we only want to see records with a sales amount over $50,000.

  1. Open the Crystal Reports sample report Group.rpt. This report demonstrates grouping data on the Country and Customer Name fields. It shows the previous year's sales by customer and their percentage of the total sales.
  2. Save the report as "Select Expert Tutorial.rpt".
  3. Click the menu items Report | Select Expert.
  4. The Choose Field dialog box opens for you to select the field to filter on. Select the Customer.Country field.
  5. The Select Expert dialog box opens with the Customer.Country tab shown. For the comparison type, select Is One Of from the dropdown box.
  6. In the second dropdown box, select each of the following values: Canada, England and USA. This selects all records that are from one of those three countries.
  7. Create a second filter field by clicking on the tab and select the field Customer.Last Year's Sales. Click the Ok button to go back to the Select Expert dialog box.
  8. For this field we want all sales that are greater than $25,000. For the condition select Is Greater Than or Equal To. In the second dropdown box type in $25,000.
  9. To make sure you've entered both conditions properly, click on the Show Formula button in the bottom right hand corner. Compare your formula to the following:

    {Customer.Country} in ["USA", "England", "Canada"] and

    {Customer.Last Year's Sales} >= $25000.00

  10. Make any necessary corrections to your formula if there is a mistake.
  11. Preview the report and it should look like the following. Notice that each sales amount is greater than $25,000.

To read all my books online, click here for the Crystal Reports ebooks.