Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

4.07 Tutorial 4-2. Selecting Records by Grouping Data

Tutorial 4-2. Selecting Records by Grouping Data

Let’s modify the previous report so that it shows the details for all countries that had last year total sales greater than $100,000. This requires deleting the two previous fields from the record selection and summing the total of last year’s sales.

  1. Open the report from the previous example, Select Expert Tutorial.rpt. Save it as Grouping Tutorial.rpt.
  2. Select the menu items Report > Select Expert. This opens the Select Expert showing the two fields added in the previous example.
  3. Click on the Delete button twice to remove the two existing fields.
  4. Click on the tab to open the Choose Field dialog box.
  5. In this example, we don’t want to simply select the field Customer.Last Years Sales because this field is at the record source level. We want to filter the records based on the total of Last Year’s Sales for the entire Country group. This is listed near the end of the field list as “Group #1: Customer.Country – A: Sum of Customer.Last Years Sales”. Select this field and click on the OK button.
  6. For the comparison, select Is Greater Than and enter a value of $100,000.
  7. Click on the Show Formula button to see the formula’s text. Notice that the radio button Group Selection is selected. Crystal Reports recognized that your record selection formula is using a summary field and consequently flagged it as a group selection formula. This is automatic and you don’t have to worry about doing it manually.
  8. Click the OK button to save the changes. Preview the report and you’ll see that the detail records don’t have to have a value of more than $100,000, but the country total does. Quite a few countries had sales over $100,000 and the report is seven pages long.