Mastering Business Analysis with Crystal Reports 9 (Wordware Applications Library)

So, how useful is a report that only displays your customer names? Let's add some useful contact information, such as phone and physical address data. Of course, if you're adding more fields, you'll need to create some more space within the Details section of your report. You can accomplish this in two ways:

Both of these methods have their advantages:

Let's look at both of these methods to see how they work and when they work best.

Creating Multiple Sections (Using the Section Expert)

Adding multiple sections provides much more control over your objects than simply resizing a section. For example, if a database field within your report contains no data, you can specify that the section not print, thus eliminating unnecessary blank sections from your report.

Note

A database record that contains no value is said to contain a NULL value. NULL literally means "nothing."

Although a NULL value is real in the sense of being recognizable, occupying space internally in a computer and being sent or received as a character, a NULL value character displays nothing and takes no space on the screen (or on a report).

Crystal Reports allows you to format entire sections of your report utilizing the Section Expert. Some of the functionality of the Section Expert includes:

As you work through this book, you'll work with many of these different features of the Section Expert. For now, let's explore the Section Expert and see how it's used to add additional sections to your report. Perform the following steps:

  1. Select Report, Section from the menu bar.

    The Section Expert dialog box displays, as shown in Figure 3-8.

    Figure 3-8: The Section Expert dialog

  2. Select the Details section in the list box.

    In the list box, you select the section for which you wish to format properties.

    In this example, you'll format properties for the Details section of your report. Therefore, you'll need to select the Details section within the list box.

  3. When the Details section is highlighted, press the Insert button (toward the top of the dialog box) five times.

    You'll notice additional Details sections are added, as shown in Figure 3-9. The last Details section should be Details f.

    Figure 3-9: Adding multiple sections to your report

  4. Press the OK button on the Section Expert dialog box.

    You're returned to the Report Design area.

  5. Select the Design tab to view your report in Design mode.

    The Customer Name field should reside in the Details a section. The newly inserted sections reside underneath this section (Details sections b through f), as shown in Figure 3-10.

    Figure 3-10: Additional Details sections (added using the Section Expert)

  6. From the Field Explorer pane, expand the Database Fields node.

    After you expand the Database Fields node, insert the following Customer fields into your report, in the following manner:

    • Add the Address1 field into section Details b.

    • Add the City, Region, and Country fields into section Details c.

    • Add the Postal Code field into section Details d.

    • Add the Phone field into section Details e.

    • Leave section Details f blank. Leaving this section blank creates some extra space between records.

  7. Select the Preview tab to preview the results of your work.

    Your screen should look something like Figure 3-11.

    Figure 3-11: Adding multiple sections to your report

Looking at the results of your work, you may notice that the city, region, and country codes are spaced a little too far apart. Nothing screams "computer-generated report" louder than strange spacing of your data.

You can correct such spacing problems through the use of formulas in a process known as conditional formatting. You'll learn about conditional formatting, as well as more information on the Section Expert, in Chapter 10.

Adding White Space to Your Report

You may have noticed that Crystal Reports separates sections by thick, gray lines. These gray lines determine the default size of the sections. You can move these boundary lines around as you wish, physically controlling how large (or small) you want a report's section.

To add white space to a section, try the following:

  1. Move your cursor pointer over the lower thick, gray line that rests at the bottom of the Details f section.

  2. You'll notice the cursor pointer change into a resizing cursor.

  3. Hold down your left mouse button. With your mouse button held, drag the cursor down to stretch the boundary line.

    You'll find the section enlarged.

Once you've done these steps, view your report within the Design tab.

Figure 3-12: Dragging a section's border to create white space

Although dragging the bottom border of a section is the easiest way to add white space, there is another option available (in addition to using the Section Expert). You can add white space to your reports using a horizontal guideline.

Adding Space with Guidelines

We discussed vertical guidelines earlier in this chapter. Horizontal guidelines are similar in the sense that objects snap to them. However, there are two main differences between vertical and horizontal guidelines:

Each time you add a horizontal guideline to a section, the section grows. Thus, horizontal guidelines are another way to increase the white space in a section. To add a horizontal guideline to a section (and therefore increase the amount of white space), perform the following steps:

  1. Right-click in the gray section name on the left side of the Report Design area. An options menu displays.

    In this example, right-click in the gray portion of the Details f section (near the text that reads "Details f"). Figure 3-13 on the following page displays a menu of options available from the sections.

    Figure 3-13: Accessing a section's options menu

  2. This options menu contains four features for horizontal guidelines: Insert Line, Delete Last Line, Arrange Lines, and Fit Section. Select Insert Line.

    Table 3-3 displays the horizontal guideline functionality available from the section's options menu.

    Table 3-3: Horizontal guidelines options

    Horizontal Guideline Option

    Description

    Insert line

    Adds additional horizontal guidelines to a section, enlarging the size of the section.

    Delete last line

    Removes the last horizontal guideline within a section, shrinking the size of the section.

    Arrange lines

    Rearranges the horizontal guidelines within a section so that they contain equal space between.

    Fit section

    Shrinks the size of the section to the lowest object within the section. Any guidelines that exist below this lowest object are removed.

  3. Select the Insert Line option three times.

    Your screen should look something like Figure 3-14.

    Figure 3-14: Using horizontal guidelines to add white space

Категории