Define Header, Footer, and Break Frames

To add information at the top and the bottom of printed page, define a header frame and a footer frame in a report (or a form used for printing). To conditionally include information in a report, define break frames.

For example, you can print front or back pages, totals, or suppress printing if an entity has no occurrences.

To define frames for printing:

  1. Create a Report component and define its data structure. For more information, see Constructing Forms and Reports.
  2. In the Resource Browser, select the type of frame you want to insert..

    A frame is automatically inserted in the appropriate position on the component. You can only insert one header and one footer, but you can insert multiple break frames to handle different conditions.

  3. Define the layout and content for each frame, including the dimensions, labels, fields.

    You can only insert non-derived fields in these frames.

    • Ensure that any field is large enough to display the data it contains.
    • If you draw a multi-line field, ensure that the frame width is larger than 9 characters.
  4. In the Define Script worksheet, use the following triggers to assign values to its non-derived fields and to print break frames.
    1. You can use the getFocus trigger of a frame to assign values from variables or ProcScript functions:
      trigger getFocus ; of frame TRAILER.USYS
         PAGE.TRAILER = $page
      end

      You cannot use the frame's getFocus trigger to assign data from fields in other frames. If you want to do this, assign the data to a variable, and load the data from the variable into the relevant frame, using its appropriate trigger.

      ; $NAME$ is a component variable
      trigger getFocus ; of entity CUSTOMER
         $NAME$ = NAME.CUSTOMER ;store customer name in $NAME$
      end
    2. To print the break frames, use the printbreak statement in the getFocus or leavePrinted triggers

      For example, to start a new page and print a break frame (BREAK_TEXT) only when the invoice date changes, enter the following ProcScript code in the getFocus trigger of the INVOICE entity:

      trigger getFocus ; of entity INVOICE
      compare/previous (INVDATE) from "INVOICE" ;check if date of previous
                                                ;invoice is different
      if ($result != 1)                         ;previous date is different, or
                                                ;no previous invoice
         if ($curocc(INVOICE) > 1)              ;and if this is not the first invoice
           eject                                ;force page break for new invoice date
         endif
         printbreak "BREAK_TEXT"                ;print break frame BREAK_TEXT for
                                                ;column titles and invoice date
      endif
      
      end; getFocus

Related Topics