Conditionally Suppressing Sections


You may think that conditional suppression is only useful when you have multiple sections. While the full benefit of multiple-section reporting is often realized with by using conditional suppression, there may be times when you want to control the appearance of just a single section. Using the Conditional Formula button next to the Suppress property lets you supply a Boolean formula to determine when the section appears or doesn t appear. Consider the following examples.

Printing a Bonus Message for Certain Records

You are designing a list of orders by salesperson. You want a bonus message and a lots o money graphic to appear below the order if it exceeds $2,500. However, if the order doesn t exceed the bonus level, you don t want the large blank space to appear where the graphic and message are located. If you just use the Format Editor to conditionally suppress the graphic and text object containing the message, they won t appear, but the empty space still will.

Simply create a Details b section and place the graphic and text object in it. Then, suppress Details b when the bonus isn t met, using the following conditional formula for the Suppress property:

 {Orders.Order Amount} < 2500 

Figure 10-11 shows the result.

click to expand
Figure 10-11: Multiple details sections with conditional suppression

Printing a Different Page Header on Page 2 and Later

You may wish to print a title page or other large page header on page 1 of the report, perhaps containing a logo and large formatted title. However, on subsequent pages of the report, you want a less flashy header with smaller type and no graphic. You want column headings and the print date and time to show up on all pages of the report, including the first.

This presents a special reporting problem. The flashy page header can simply be put in the report header section. It will then appear only on the first page. However, if you put the smaller report title in the page header along with the column headings and other information, it will appear on page 1 along with the report header. You can use the Format Editor to suppress the object containing the smaller header, but then extra white space will appear on page 1.

The solution is to create a second page header section. Put the smaller report title in Page Header a and put the column headings and print date/time in Page Header b. Then, conditionally suppress Page Header b so that it won t show up on page 1. Here s the conditional formula, which uses the PageNumber built-in function:

 PageNumber = 1 

Printing Odd and Even Page Headers or Footers

You may be printing your report on a duplex laser printer that can print on both sides of the paper. Or, you may want to photocopy your report from one to two sides and place it in a three-ring binder or other bound format. Crystal Reports lets you create separate odd and even page headers and footers to add a real page-published look to your report.

Simply create separate Page Headers a and b (and, perhaps, Page Footers a and b). Place the appropriate material in each section and position it properly for odd/even appearance. Now, conditionally suppress the sections. The sections containing the material for odd page numbers will be suppressed for even page numbers with the following conditional formula:

 PageNumber Mod 2 = 0 

Also, the sections containing the material for even page numbers will be suppressed for odd page numbers with the following conditional formula:

 PageNumber Mod 2 = 1 

These formulas use the PageNumber built-in function illustrated previously. In addition, they use the Mod function, which will indicate whether a page number is even or odd (even page numbers divided by 2 return a remainder of 0, and odd page numbers return a remainder of 1, as explained earlier in the chapter).




Crystal Reports 10
Crystal Reports 10: The Complete Reference
ISBN: B005DI80VA
EAN: N/A
Year: 2004
Pages: 223
Authors: George Peck

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