Print a Layout-dependent reference (InfoNodes)

Use InfoNodes 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. For a report layout that works 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 line items on the report.

In the report design document (.4rp)

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 creates an invisible column in your report line containing the value of the InfoNode.

    The Value property of the InfoNode must be a String.

    You can use the fglValue member of the FGLNumericVariable class to convert overalltotal:
     overalltotal.fglValue
    This formats the value of overalltotal as a String based on the default format set in the Genero DVM.
    You can also 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 used to determine the maximum length of the value in the InfoNode, because 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 from a numeric data type, or MMMM as the maximum length for a value 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.

Example

Figure 1 shows an example report structure (from the OrderReport.4rp report in the Reports demo). Figure 2 shows how this report looks when run.

Figure: Report Structure with reference box and info node


This figure shows the Report Structure with a Reference Box in the Any Page header, and an Info Node under On Every Row. The Reference Box uses the InfoNode Name property to connect to the Info Node.

Figure: Report showing total in a reference box


This figure shows a report with a Reference Box displaying the total from an Info Node.