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

HANDS-ON (Sorting, Grouping, and Totalling)

When you insert a database field into your report, the data within the fields appears in the order it was originally entered into the database.

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

As you can see, pinpointing information in this kind of report would be difficult. It would be much easier to review or find information when you can see it sorted in a logical format. For instance, you may want to have a customer list sorted alphabetically by name or by country. That is known as a single field sort.

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

SGT01.RPT file in the \CRW directory.

280

Seagate Crystal Reports User’s Guide

How to do a single field sort

To get started, create a report using the customer table in 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}

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.

4 Click the Add button.

3 Highlight the field to be sorted from this list.

5 The selected field will be added to this list.

7 Click OK when finished.

6 Specify the sort direction.

Records are sorted based on the values in the sort field.

For example, if you choose to sort the {customer.COUNTRY} field in ascending order, the report would appear as follows:

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

Sorting, Grouping, and Totalling

281

The Regions within each Country remain unsorted.

Countries are now sorted in alphabetic order.

Notice that the records are displayed in alphabetic order by country: all of Canada, then Spain, then the United States. There is no further sorting of these records, however. If you want your customers sorted by Country and then, for example, by Region, you need to do a multiple field sort.

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

SGT02.RPT file in the \CRW directory.

Related Topics

Reporting 101, Page 95

How to do a multiple field sort, Page 283

How to sort records within groups, Page 287

282

Seagate Crystal Reports User’s Guide

How to do a multiple field sort

Using the report you created in How to do a single field sort, Page 281, you can further organize your data sorting on multiple fields.

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.

2 Highlight the field you want the data sorted by first and click the Add button to add it to the Sort Fields list.

3 Highlight the field you want

4 The selected fields are

the data to be sorted second and

displayed in the order

add it to the Sort Fields list.

 

they are sorted.

 

 

 

 

 

6 Click OK when finished.

5 As you add each field to the Sort Fields list, specify the sort direction.

Records are sorted by Country first and then by Region.

For example, if you choose to sort first by the {customer.COUNTRY} field and then by the {customer.REGION} field, both in ascending order, the report would appear as follows:

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

Sorting, Grouping, and Totalling

283

The Regions within each Country are sorted in alphabetic order.

Postal Codes within each Region are unsorted.

Countries are sorted in alphabetic order.

Notice that the data is in order by Country, and where a country has customers in different regions, those regions are sorted in alphabetic order as well.

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

SGT03.RPT file in the \CRW directory.

Related Topics

Reporting 101, Page 95

How to do a single field sort, Page 281

How to sort records within groups, Page 287

284

Seagate Crystal Reports User’s Guide

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