Tutorial 4-1. Selecting Records
Let’s put what we learned about selecting records to use. In this tutorial, we 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 $25,000.
- 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.
- Save the report as Select Expert Tutorial.rpt.
- Click the menu items Report > Select Expert.
- The Choose Field dialog box opens for you to select the field to filter on. Select the Customer.Country field.
- The Select Expert dialog box opens with the Customer.Country tab shown. For the comparison type, select Is One Of from the dropdown list.
- In the second dropdown list, select each of the following values: Canada, England and USA. This selects all records that are from one of those three countries.
- 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. - For this field, we want all sales that are greater than $25,000. For the condition criteria, select Is Greater Than or Equal To. In the second dropdown list type in $25,000.
- 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
- Make any necessary corrections to your formula if there is a mistake.
- Preview the report and it should look like the following. Notice that each sales amount is greater than $25,000.