Sorting Single Fields


To understand the concept of sorting, let's first create a new report, which you'll use throughout this chapter.

Start Crystal Reports and create a new blank report. Add the Product, Product Type, and Purchases tables. Allow the Smart Linking feature to link these tables, or refer to the ER Model diagram in Appendix A.

Once you're at the Report Design area, place the Product Name and Product Class fields (from the Product table), the Product Type Name field (from the Product Type table), and the Units in Stock and Units on Order fields (from the Purchases table) in the Details section. Resize any of the fields as necessary so that all information displays. Once you've done this, preview your report; it should look something like Figure 8-2.

click to expand
Figure 8-2: Unsorted data within the Product Inventory Report

Looking at this report, you'll notice that there isn't any real order to how records display. For example, look at the Product Name information on the first page of your report. You have a number of glove products, followed by some helmet products, followed by more glove products.

Finding information within this report is like looking for a needle in a haystack.

To make this report more meaningful, let's add some sorting functionality. Perform the following steps to sort the report:

  1. Select Report, Record Sort Expert from the menu bar.

    The Record Sort Order dialog box displays, as shown in Figure 8-3.

    click to expand
    Figure 8-3: The Record Sort Order dialog box

  2. Select the Product Type Name field from the Available Fields list box.

    This is the primary field that you wish your report to sort. This field is located in the Product Type table.

  3. Press the Add button (>).

    You'll see the Product Type Name field display in the Sort Fields list box, as shown in Figure 8-4.

    click to expand
    Figure 8-4: Sorting your report by the Product Type Name field

  4. Select the Ascending option button.

    This sorts records upward (in this case, alphabetically from AtoZ).

  5. Press the OK button.

    Figure 8-5 displays the results of your work.

    click to expand
    Figure 8-5: A report with single sorting functionality




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