Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

6.04 Selecting Records for Grouping

Selecting Records for Grouping

Setting a filter on summary data isn’t done with the regular selection formula. Selecting records has the limitation that you can only set filters for raw data or basic formulas. You can’t set filters that operate on summary fields or on formulas built with summary fields. You also can’t use any fields that use second-pass data. As mentioned in Chapter 1, second-pass data includes summaries and subtotals. The reason for these restrictions is that filtering is done during a report’s first pass. Second-pass data hasn’t been calculated yet and consequently you can’t filter on something that doesn’t exist.

To get around this problem, you have to perform a grouping selection. Crystal Reports performs grouping selections during the second-pass when summary data is available.

There are two ways to add a grouping selection. The first way to add a grouping selection is to right-click on the report designer and select Reports | Edit Selection Formula | Group. This brings up the Formula Editor dialog box where you can enter the necessary formula.

The second way is using the standard Select Expert dialog box and entering the filter as you normally would. The expert automatically recognizes that the formula entered is only valid as a grouping filter and will flag it as such. You can see this by clicking on the Show Formula button and the Grouping option button will be selected.