|
Return to Newsletter Contents...
Crystal Reports XIR2 - Working with Sections
by: Tom Hinkle, BI Consultant, CRCP
Crystal Reports organizes the report into sections when it
is created. Using these sections
effectively can produce a very professional looking and performance optimized
report.
About sections
Crystal Reports provides five design areas to use when
building your report:
- Report Header
- Page Header
- Details
- Report Footer
- Page Footer
Each area contains a single section when you first create a new report. You
cannot delete any of these original sections but you can hide them or add to
them. Once you have added sections, you can delete them, move them in relation
to other similar sections, or merge related sections together.
Working with sections
Many of the procedures in this article show you how to
work with sections in the Section Expert. Sections can also be inserted,
deleted, and so on by right-clicking the shaded area to the left of the section
in the Design or Preview tabs and choosing the appropriate option from the
shortcut menu.
Inserting or deleting a section
-
Click Section Expert on the Expert Tools toolbar
-
Highlight the section you want to insert a section after
or delete
-
Click Insert or delete
Moving a section
(once you have created a multiple of one of the original five sections)
-
Click the Section Expert on the Expert Tools
toolbar
-
Highlight the section you want to move
-
Click the Up or Down arrow to move the section
Note:
Merging two related sections
-
Click Section Expert on the Expert Tools
toolbar
- Move the sections so the two sections you want to
merge follow each other in the list
- Highlight the top section
- With Section (B) highlighted, click
Merge and Section (C) will be merged with Section (B) to form one
section
- Rearrange the objects as needed
Splitting and resizing sections
A section can be split into two or more sections and/or
resized easily in the Design tab:
Splitting a
section
- Move the pointer over the left boundary of the section
you want to split
- When the pointer becomes a Section Splitting cursor,
click the boundary and drag the pointer into the section
- When a horizontal line appears, drag it up or down to
split the section the way you want it
Resizing a
section
-
Move the pointer over the bottom boundary of the section you want to
resize
-
When the pointer becomes a Resizing cursor, drag the boundary to make the
section bigger or smaller as you wish
Using
multiple sections in reports
Certain reporting tasks are performed
most efficiently by creating multiple sections within an area, such as:
- Keeping variable length objects from overwriting each
other
- Eliminating blank lines when fields are empty
- Adding blank lines under specific conditions
Keeping
variable length objects from overwriting each other
When
variable length objects are placed above other objects in one section of
the report while the Can Grow option for the variable length object is toggled
on in the Format Editor, that object may overprint objects positioned directly
below it unless you have:
- Expanded the section to fit the maximum size of the
object
- Spaced the objects, allowing enough space for the first
object to complete printing before the second one begins
You can
eliminate this overprinting problem by creating multiple sections in an area and
placing objects below the variable length object in their own section(s).
Eliminating
blank lines when fields are empty
-
In the Section expert, highlight the section
-
On the
Common tab, select the Suppress Blank Section check box
Note:
If the report section you want to suppress contains a blank subreport, use the
Suppress Blank Subreport option, found on the Subreport tab of the Format
Editor, as well as the Suppress Blank Section option.
Adding blank lines conditionally
Use multiple
sections to print a blank line on your report under specific conditions. For
example, you may want to insert a blank line after every fifth record in the
report.
To add blank lines conditionally
- Use the Section Expert to create
two Details sections.
- Place the report detail data in the top section.
- Leave the second section empty.
- In the Section expert, highlight the second section.
- On the Common tab, select the Suppress (No
Drill-Down) check box then click the conditional formatting button to
its right.
- Enter the following formula in the Format Formula
Editor:
Remainder (RecordNumber,5) <> 0
This formula
divides each record number by 5. If the division produces a remainder, it
suppresses the blank section. But if the division produces no remainder, a zero
(which it will for every fifth record printed), the program prints the second
section, thus inserting a blank line.
Go to Top |
Return to Newsletter Contents
|