Crystal Reports: Range in Page Footer
Further to our hint in the article about an index
in the page footer, what about a range where the data aren't sorted?
For
example, we wanted to show the highest and lowest value of a field’s
values on the page. The solution is a slight variation on the solution we used for
the index in the page footer:
A formula in the Page Header: (Supress)
WhilePrintingRecords; global numbervar Top:={table.field};
global numbervar Bottom:={table.field}
A formula in the Details: (Supress)
WhilePrintingRecords; global numbervar Top; global
numbervar Bottom;
If {table.field}> Top then Top:={table.field};
If {table.field} < Bottom then Bottom:={table.field}
A Formula in the Page Footer:
WhilePrintingRecords; global numbervar Top; global
numbervar Bottom;
"Range: " + Totext(Top,0) " to "
ToText(Bottom,0)
This technique can be used only on the page footer.
The page header can only see the record at the top of the page. It is not
aware (yet) of the other records to be printed on the page.
More about footers
Speaking of footers, you can use two page footer sections
for odd and even page footers.
If you look at any professionally prepared bound, double
sided publication you will see the page footers are different on the odd and
even pages. The Even numbered pages on the left of the binding often have
the page numbers on the left, and other copyright information on the right,
while the right hand, odd numbered pages have these fields the other way
around.
The theory is that if you are looking for a specific page
number, then you can thumb along the pages and see all the page numbers on
the outer edge of the document.
You can achieve the same effect in your Crystal Reports by
using a Page Footer a and Page Footer b section with the two layouts you
want. Then conditionally suppress the sections using a formula of
Remainder(PageNumber,2)=0 //To suppress if page number is
even
And
Remainder(PageNumber,2)=1 //To suppress if page number is
odd
You might also want to use the section formatting option "Reserve Minimum
Page Footer" to give you a little more room for data on the page.
And speaking of formatting....
This is based on the book, Crystal
Reports 8.5: The Complete Reference. At one time, creating a good-looking report involved these steps:
- Extracting data from a database and into a text file
- Possibly manipulating those data in an intermediary program, like
Excel
- Importing those data into a word processor or desktop publishing
program and cleaning them up
- Formatting everything and playing with various settings until it
looks OK.
With Crystal Reports, you can—in most cases—create reports directly
from the database. This saves a lot of extra work—non-value added work
that is terribly boring.
Crystal Reports has:
- A full range of text formatting options
- Text rotation
- The ability to set object foreground and background colors
- Settable unique borders
- Drop shadows
- Special fonts
- Ability to include bitmapped images
- Ability to draw lines and boxes around areas you wish to highlight
- An actual highlighting feature that changes background colors
conditionally
- A host of conditional formatting options
- A host of absolute formatting options
- The Suppress Property, which allows you to hide information (such as
zeroes or empty field items)—this is similar to Word’s ability to
suppress unused fields in a mail merge. It also allows you to do some
cool things with page headers and footers.
In addition, you can use Report Alerts that activate every time you
refresh the report. This feature provides a separate dialog box to give
you a report history. It’s got some automation to it to reduce the
drudgery of digging through large report histories.
Formatting enhances the usability of your Crystal Reports. For even
more functionality, you can use third-party programs, such as the ones
available here.
All that said, here's a caution. Don't get carried away with formatting. A
report is not the place to demonstrate how many formatting techniques you can
use.Instead, you want to use the formatting to accomplish such goals as:
- Present a clean but compelling appearance.
- Guide the reader's eye to what's important. That means very little
highlighting or bolding.
- Separate information or visually group it.
- Make the report consistent with other company literature. For example,
use company colors, company logo, and the official font (if there is one).
- Create a different flavor or appearance for each type of report. For
example, financial reports have a green border, sales reports have a salmon
border, production reports have a blue border, and so on.
- Show what has changed.
- Highlight problem areas.
Avoid common color usage errors
- Don't just add colors gratuitously. Think of them as spices. They need
to bring out the flavor of the report, not bury it. And they need to work
together. Some spices clash when used together, and so do some colors.
- A common mistake with colors is to use large blocks of colored text on
the page. For example, yellow on a black background. You get maximum
readability with black text on a white background. You can use colored text
to emphasize or to bring out headings (or subheadings). But when used for
the main body of the text, it actually detracts from the report.
- Don't use colored page backgrounds. When people try to print these out,
the page becomes saturated with ink and paper jams result. With duplex
printers, the problem is twice as bad.
- Use contrasting colors. Many people can't see the difference between two
closely related light blues, for example. Variations in printing also cause
confusion. Then there's the issue of referring to the color. Bob in
Accounting is discussing the report. He can easily ask Beverly compare the
total that appears in dark blue text to the total that appears in dark brown
text. But how can he refer to the total in tan versus the one in light
brown?
- Avoid red backgrounds. These irritate the eye.
- Remember, color costs money. Use it where there's a return on that
investment (no need to calculate ROI).
- If there's no particular reason to use color, don't use it.
This article is copyrighted by Crystalkeen, Mindconnection, and Chelsea Technologies Ltd.
It may be freely copied and distributed as long as the
original copyright is displayed and no modifications are made to this
material. Extracts are permitted. The names Crystal Reports and Seagate
Info are trademarks owned by Business Objects. |