Modifying Report Section Properties

In addition to formatting properties, each section has a variety of general properties that can be used to manipulate the behavior of that section within the overall report. For example, if you would like to suppress a particular section from the report display or just hide a detail-oriented section from the initial display but enable business users to navigate to the underlying details, you can use the Section Expert to accomplish this.

Using the report you created in the previous exercise, relocate the Count summary field into the Group Header and hide the Details section to enable the viewer of the report to access this section only if he double-clicks on the Group Header summary valuescommonly known as drilling-down on report data. The following steps guide you through formatting several fields and sections, creating a drill-down report:

  1. Highlight the Summary field currently located in the Group Footer #1 section (Count of Contact Last Name) and drag it up in the Group Header #1 section so that it is positioned to the right of the Country/Pays field, approximately under the Telephone # column title. The results are shown in Figure 7.3.

     

    Figure 7.3. Report objects can be repositioned into the various report sections to change the presentation of the report.

     
  2. While the Summary count field is still highlighted, modify the font properties so that it is underlined and in a bold yellow color.

     

  3. Using what you have learned from the previous exercises, remove the background color of the Group Footer #1 sectionthe background color property can be located on the Color tab of the Section Expert. Figure 7.3 shows what your report should now look like.

     

  4. To display the listing of customer contacts for each country on a separate and unique page, open the Section Expert and select Group Footer #1 from the section list on the left. As Figure 7.4 shows, the Common tab within the Section Expert provides access to a variety of properties unique to the section that you have selected from the list on the left. In this case, check the box next to the New Page After item and click OK to continue.

     

    TIP

    Common report section commandssuch as Hide, Suppress, Delete, Hide Section Names, and Select All Section Objectsare accessible via the pop-up menu when you right-click on the applicable section's name. Some of these commands are also available within the Section Expert dialog, although unlike the Section Expert, the right-click pop-up menu pertains only to the specific section you have selected.

  5. Looking at the preview of your report, you should now see each country's list of contacts on a separate page. Although this might be desirable for those countries with a considerable number of contacts, such as Canada, France, and the United States in this report, it is not necessarily the most visually pleasing presentation for the countries that have only one or two customer contacts.

    Perhaps the majority of the business users for this report are more interested in the total number of contacts for each country rather than the actual list itself. However, a few of the business users also want to be able to access the contact list on occasion. To accommodate both groups of users, you can manipulate the properties of the Details section.

     

    NOTE

    To indicate to the business user of the report that more detailed information is available behind the summary group level, the mouse pointer turns into a magnifying glass icon when it floats over a drillable section (for example, the yellow count field of customer contacts, located in the Group Header #1 section).

  6. Disable the New Page After property that was set for the Group Footer #1 section. The Section Expert can be used to remove this setting. Click OK to continue.

     

  7. From either the Design or Preview view of your report, right-click on the Details section title to the far left of the application area and select Hide (Drill-Down OK) from the pop-up menu.

     

NOTE

Drill-down functionality is designed to make report viewing easier. You can hide the details of your report and only have the group headers and summaries visible, and, when necessary, the business users of the report can then click on the group header or summary fields to view the report details.

As shown in Figure 7.5, a list of each country with the total number of contacts displayed has now been created. Additionally, upon double-clicking the count of contacts (displayed with the underlined, yellow number) the business user of the report is quickly able to drill-down into the Details section and be presented with the actual customer contact specifications.

Figure 7.5. A manager now is presented with a summary list of customer contacts by country and is also able to access the customer contact details through a drill-down.

As you can see in Figure 7.6, after the business user drills down into a particular group's detail listing (France in this example), that group's detailed contact list is displayed in the Crystal Reports application in a separate tab and is cached so that it can be easily accessed for future reference. When a business user of the report selects a refresh on the report, all cached tabs are removed because there is no guarantee that the data being retrieved from the database would be the same as the previously cached page. The end user would have to drill back down into France if he wanted to view the detailed contact listing again.

Figure 7.6. The detailed list of customer contacts for France.

 

The Section Expert Settings and Functionality

As discussed to this point in the chapter, the Section Expert provides a great deal of powerful report formatting functionality and flexibility. There are two major areas to the Section Expert as shown in Figure 7.4the Sections area and the Formatting tabs (Common, Color, and Layout). This section presents each of these sections and their associated functionality.

The Sections Area

The Sections area is composed of a listing of all the current report's sections and five separate buttonsInsert, Delete, Merge and the up and down arrows. The Sections area takes up the entire left half of the Sections Expert dialog and enables you to create, delete, merge, and reorder entire sections within the involved report. The following list describes each of the Section Expert Sections area components:

The Common Tab

In addition to the Section Expert options that you have already used, the following segment of the chapter provides an overview of the available settings presented on the Common tab of the Section Expert. A subset or all of these options are made available when a section is selected in the Sections area, as described previously. The following options are made available in the Common tab:

The presence of the x+2 buttons to the right of the majority of the options indicates that those options can be set via a formula in addition to setting them via the dialog. When an option is set via formula, this is referred to as conditional formatting because the formula typically evaluates a condition.

To implement a conditional option, click on the x+2 button associated with the option and the Formula Editor is presented. Within the Formula Editor, a formula needs to be created that is evaluated for every iteration of the section. If the formula evaluates to a value of True, the involved option is applied; otherwise, it is not. A simple but practical example of conditional section formatting could be a marketing campaign list where the marketing department wants to contact customers in the USA by phone and everywhere else by mail. Two detail sections could be created, one that includes Contact Name and Phone Number, the other with Contact Name and Mailing address. The first section can be conditionally suppressed on the following formula{Customer.Country} <> "USA" to only show that section for USA-based customers. The second details section would be conditionally suppressed with {Customer.Country} = "USA" to only show non-U.S.-based customers.

The Color Tab

Use the Color tab to set the background color for the entire highlighted section. This can be done absolutely or conditionally. A good example of a conditionally colored background is when presenting a lengthy list of detailed items. To enable easier reading of the report, every second row can be conditionally colored Silver with the following formula:

Listing 7.1. Alternate Row Coloring Formula

IF RecordNumber Mod 2 = 1 THEN Silver Else White

 

The Layout Tab

The Layout tab only appears when you have the details section selected and the Format with Multiple Columns check box has been selected on the Common tab. This tab enables multi-column formatting. As described earlier, this kind of report enables you to present multiple columns of standard row data and have the data flow from column to column. This tab, shown in Figure 7.7, has four distinct settings:

Figure 7.7. The Layout tab is only available for advanced multicolumn reports.

TIP

When you format a report to show multiple columns, the Crystal Reports engine reviews the fields in the detail section and sizes the columns in the rest of the report based on the width of those fields. As such, if data labels (text fields) are placed in the detail section for row identification, these increase the width of the report's columns and reduce the number of columns that fit onto a page. To place such fields, consider placing them in a Page or Group header and underlaying them onto the Details section. This is presented in a sample format later in the chapter.

Категории