Consultor Eletrônico



Kbase 16353: Printing a Form to the Bottom of the Page in Report Builder
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
Printing a Form to the Bottom of the Page in Report Builder


This example shows how to print a form in RB that continues
down to the bottom of the page even if there are not enough
records to fill the form. The example uses the sports
database. The example also assumes that the form will
contain a maximum of 5 records on the page (the maximum
number of records per page are up to you).


1. Create an instant report. Select the customer table.
Select the Cust-Num field. Delete the page header band
line to avoid confusion. Move the Cust-Num field over to
the right and type a label in front of it (or draw
rectangles to create a complete form).
Ex:
record-line| Customer Number: Cust-Num

Create the following filter:
Cust-Num < 4

The filter will cause only three record to print.

2. Create a calculated field called Calc1. Place the number
1 in the expression box. This will make the calculated
field a constant of 1.

3. Make the primary sort for the report (the first sort) on
Calc1. This does not change the sort order for the report
since Calc is always equal to 1. It does allow you to
create a group footer line for Calc1 that will print only
once at the end of the report.

4. Create 5 group footer band lines for the Calc1 group (1GF-
Calc1). Place the same label (or form) on this line as
you used in the record line (without the fields).

Ex:
1Gf-Calc1 | Customer Number:

5. Create an aggregate field called ag1 that is a count on
Calc1 that has no-reset and accumulates every-composite
(under options). This will be used to determine the
number of record lines printed.

6. Now you need to create 5 calculated fields that the 5 band
lines will print conditionally on. Name them Line1,
Line2, Line3, Line4, and Line5.

Line1

IIF(ag1 < 1, true, false)

Line2

IIF(ag1 < 2, true, false)

Line3

IIF(ag1 < 3, true, false)

Line4

IIF(ag1 < 4, true, false)


Line5

IIF(ag1 < 5, true, false)


7. Double click on the first 1Gf-Calc1 band line to bring up
the band line properties. Check the "Enable Conditional
Printing" toggle box. Select Line1 from the combo box
and check the "Print when field is True" toggle box.

Do this for the remaining 4 1Gf-Calc1 band lines. Use
the calculated field Line2 for the second band line,
Line3 for the third band line, Line4 for the fourth band
line, and Line5 for the fifth band line.


8. Add Calc1 and ag1 to the record line so that you can see
the values that they hold during each record iteration.
You may also want to add the 5 other calculated fields to
the record line to see how their values change for each
record iteration.

This allows the report to continue printing the form
depending on the number of records printed in the record
line. If there are 3 records printed in the record line, the
first band line will not print because Line1 is false (ag1 is
not < 1). The second band line will not print because Line2
is false (ag1 is not < 2). The third band line will not
print because Line3 is false (ag1 is not < 3). The fourth
band line WILL print because Line4 is True (ag1 is < 4). The
fifth band line will print because Line5 is true (ag1 is <
5).

Change the value in the filter to see how the report reacts.
You will get 4 of the 1Gf-Calc1 band line to print if the
filter is "Cust-Num < 2" (one record line is printed).

We assumed that the total number of lines that the report could
contain would be 5 for this example. If your report needs 100
lines, you would need to create 100 calculated fields (Line1,
Line2 ... Line100) to use for 100 1GF-Calc1 band lines.

Progress Software Technical Support Note # 16353