InfoNodes allow you to print a value on the report that depends on the paged stream
resulting from the report layout.
For example, a value for "total from previous page" can vary depending on how the page options
for a report are set. In order to have a report layout that will work with various page sizes, you
can use an InfoNode and a Reference
Box.
This example illustrates how to print the total price (overalltotal) from a
previous page.
In the Genero BDL report program
The
REPORT block of the Genero BDL file must calculate the desired value and output it
to the report. The following example is from the
OrderReport.4gl file in the
demo sample
programs:
ON EVERY ROW
LET lineitemprice = orderline.lineitem.unitprice * orderline.lineitem.quantity
LET overalltotal = overalltotal + lineitemprice
LET ordertotal = ordertotal + lineitemprice
PRINT orderline.*, lineitemprice, overalltotal, ordertotal
The
variable overalltotal contains the running total price of the lineitems on the
report.
In the report design document (.4rp)
You will use these
objects from the Toolbox in your report design:
- InfoNode -
place this object in the container for the ON EVERY ROW trigger of your
Structure view. This will create an invisible column in your report line containing the value of the
InfoNode.
This will format the value
of
overalltotal as a String based on the default format set in the Genero DVM. Or, you can
use the
format method of the
Numeric class to convert to a
string and also specify the format, as in this
example:
overalltotal.format("-,---,---,--&.&&")
- Reference
Box - place this object in the Page Header at the top of the report structure.
- For the InfoNode name property, enter the name of the InfoNode that you created.
- For the text property, enter a string that will only be used to determine the maximum
length of the value in the InfoNode, since the value will not be known at the time the ReferenceBox
is positioned. Examples: Enter "000,000.00" as the maximum length for a value that is from a numeric
data type, or "MMMM" as the maximum length for a value that is from a CHAR(4) data type.
- WordBox - optionally use this object to add some text next to the Reference Box.
A Reference Box points to the immediately previous occurrence of the InfoNode value in the
paged stream. Because you placed the Reference Box in a Page Header, it will point to the last
occurrence of the overalltotal value on the previous page.