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 Java, C# or PHP report program

The report application must calculate the desired value and output it to the report. For example, you can create a variable named overalltotal to accumulate and hold the running total price of the line items of a 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 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.