Chapter 8 - Advanced Formatting Techniques
Once you've mastered the basics of creating reports, it's time to learn some of the finer points of report design. Crystal Reports gives you numerous formatting options for printing report sections for specialized purposes. For example, you can create specialized reports such as labels or multi-column reports. You also have the option of creating multiple sections within a report and format each section individually. This one feature gives you an almost unlimited number of ways to make a report fit different scenarios and customize it for individual users. The first part of this chapter covers how to format Sections to create professional reports for any circumstance. You are given lots of creative examples of how to use Sections in real world reports.
Advanced Report Formatting with Sections
Hiding and Suppressing SectionsHiding a section is used for drilling-down on detail records. This presents the user with a much smaller report because the groups only show summary information. They can look at the detail information by double clicking on the group header. This creates a new tab in the viewer with the detail information being displayed inside.
Suppressing a section is done when you don't want the user to see the information in it nor do you want them to be able to drill down into it. Of course, this leads to the question that if you don't want the user to see the information then why did you add the section? Suppressing sections is usually used in conjunction with conditional formatting. The Formula Workshop is used to turn this option on or off depending upon other data that the report has access to. For example, if this is sensitive data, then you would only let administrators see the detail information. All other users would have the detail section suppressed and they would only be able to see the summary information. This effectively lets you use the same report for different users and different purposes.
Printing Sections at the Bottom of a PagePrinting sections at the bottom of the page is useful when printing reports that are one page long and have summary data listed at the bottom. An example is an invoice where the bottom of the page prints the total amount due. Invoices also print the aging schedule of past due balances at the bottom of the page. Another example is a form letter that requires authorized signatures of certain parties. Printing sections at the bottom of the page is done by adding a group to the report and checking the Print at Bottom of Page option for the Group Footer.
|Although the Details section has the Print at Bottom of Page option available, it has no effect. The detail records always print one after the other from top to bottom.|
Forcing a Page BreakIt is very common to want groups to appear by themselves. Data in each group is listed separately from the other groups. Forcing page breaks makes data from each group appear on their own pages. The group is used to identify where one report ends and the next one starts. An example is a report that has to be broken apart and distributed to multiple people.
Page breaks can be forced to occur either before or after a section. Unfortunately, each option has the problem of always printing an extra blank page. If you force a page break before a group header, then the first page of the report is blank. If you force a page break after the group footer, then the last page is blank. The way around this is to use one of two built-in functions in the conditional formula: OnFirstRecord or OnLastRecord. By doing a Boolean Not in the formula, it temporarily turns page breaks off for the section. For example, if you wanted to force a page break after the group footer, use the following formula (using Basic syntax) in the New Page After format option: Formula = Not OnLastRecord This formula returns True for every record leading up to the last record. Thus, there is always a page break after the group footer. Once the last record is printed, this formula returns False and the option to force a page break is turned off. The last page will not have a page break printed after it.
Resetting the Page NumberResetting a page number back to Page 1 makes the page appear as if it is the first page in the report. This is good to use in combination with forcing a page break after a section. For example, for the Group Footer, set the both of the properties New Page After and Reset Page Number After to True. When you distribute the pages of the report to different people, each person will have a report that starts on page 1. They won't know that the pages they received were part of a much larger report that was broken apart.
Keeping Sections TogetherSince it is common to print a lot of data in a section and since it is very hard to control exactly where a section is printed on a page, sections are commonly split across pages. A report can start printing a section at the bottom of the page but not have enough room to print all of it and print the remaining portion of the section on the next page. If it is important that all the information within a section be printed together, check the Keep Together option. Before the section is printed, it is analyzed to see whether it fits on the page. If it doesn't fit, a page break is forced and the section starts printing at the top of the next page.
When using this formatting option with groups, the report tries to fit the entire group (including the header and footer) onto the page. If the group is larger than one page, a page break is forced and the group gets printed on the next page.
Suppressing Blank SectionsPrinting sections that don't have any data leaves blank rows in the report. This makes a report look unprofessional because of the gaps that seem to randomly occur. To fix this, set the option Suppress Blank Section to skip over sections that don't have any data. This option is used most frequently in conjunction with creating multiple report sections. This is covered in more detail later in the book, “Adding Multiple Sections”.
To read all my books online, click here for the Crystal Reports ebooks.