Understanding Sorting


When a report grabs records from a database, the records typically display in an order determined by data type. The sort order that most databases use for records is summarized in Table 8-1.

Table 8-1: The data type order of a database sort

Field Type

Sort Order

Single-character string fields

Blanks

Punctuation

Numbers

Uppercase letters

Lowercase letters

Multiple-character string fields

Two letters

Three letters

Four letters

Five letters

... etc.

Currency fields

Numeric order

Number fields

Numeric order

Date fields

Chronological order

DateTime fields

Chronological order

Same-date values by time

Time fields

Chronological order

Boolean comparison fields

False values (0)

True values (1)

NULL values

NULL values

Non-NULL values

Unfortunately, this order is rarely useful. For example, check out Figure 8-1. In this figure, there's a report that pulls records from the Supplier table. Notice that there's no meaningful order as to how the records display (for example, the records don't display in alphabetical order).

click to expand
Figure 8-1: A report with no sorting order

Luckily, Crystal Reports allows you to sort text, numeric, and date fields in the two following orders:

  • Ascending, which means records sort upward (such as from lowest to highest, earliest to latest, first to last, or A to Z)

  • Descending, which means records sort downward (such as from highest to lowest, latest to earliest, last to first, or Z to A)

In Crystal Reports, you also have the choice of sorting on only one field (known as single field sorting) or more than one field (known as multiple field sorting). In Crystal Reports, all sorting is handled through the Record Sort Order dialog box.




Mastering Business Analysis with Crystal Reports 9
Mastering Business Analysis with Crystal Reports 9 (Wordware Applications Library)
ISBN: 1556222939
EAN: 2147483647
Year: 2004
Pages: 177
Authors: Chris Tull

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net