Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
CRW_REF.PDF
Скачиваний:
5
Добавлен:
13.02.2015
Размер:
13.99 Mб
Скачать

How to group data

Sometimes sorting is not enough. You may want to break data into meaningful groups. Seagate Crystal Reports allows you to group data in one easy step.

NOTE: It is unnecessary to sort data before you group it. The program does the necessary sorting automatically, as part of the grouping procedure. If you just want your data sorted, follow the sorting procedures outlined in How to do a single field sort, Page

281, and How to do a multiple field sort, Page 283.

To get started, create a report using the sample data, CRAZE.MDB, and place the following fields from left to right in the Details section:

{customer.CUSTOMER NAME} {customer.REGION} {customer.POSTAL CODE} {customer.COUNTRY}

You will use this same data for the topic How to sort records within groups, Page 287, as well:

Click the INSERT GROUP button on the supplementary toolbar. The Insert Group dialog box appears.

NOTE: This example report has been designed to illustrate concepts only, not the actual look of your finished report.

Sorting, Grouping, and Totalling

285

3 Select the field you want your data grouped by from this drop-down box.

4 Next, specify the sort direction.

5 Click OK when finished.

The Customers are grouped by Country.

The groups are also sorted in ascending (A-Z) order.

But, the records within each group are unsorted.

Notice that the values are grouped by Country, and the Country groups appear in ascending (A to Z) order. Notice too, however, that the records within each group remain unsorted. To remedy this, you need to sort the records within each group. See How to sort records within groups, Page 287.

286

Seagate Crystal Reports User’s Guide

NOTE: To see an example of the above report, open the

SGT04.RPT file in the \CRW directory.

Related Topics

Reporting 101, Page 95

How to sort records within groups, Page 287

How to group based on first letter of company name, Page 301

How to group data in intervals, Page 305

How to create group headers, Page 313

How to sort records within groups

Once you have grouped your data, you can easily sort the records within the groups to further organize the information. For this example, you must first group your data using the technique in

How to group data, Page 285.

Once you have your data grouped, click the SORT ORDER button on the standard toolbar. The Record Sort Order dialog box appears.

NOTE: The following screenshot illustrates both a before and after state of the dialog box. Typically, any fields you move to the Sort Fields list box will no longer appear in the Report Fields list

box.

Sorting, Grouping, and Totalling

287

2 Highlight the field you want the records in the groups sorted by and click the Add button to add it to the Sort Fields list.

NOTE: This field specifies the sort

The selected fields are

done automatically when you

displayed in the order

grouped the data. It can’t be moved.

they are sorted.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4 Click OK when finished.

3 Specify the sort direction.

NOTE: This example report has been designed to illustrate concepts only, not the actual look of your finished report.

The customers within each country are sorted.

The data is grouped by Country.

288

Seagate Crystal Reports User’s Guide

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]