Create labels: the report program (Genero BDL)

A common use of reports is to create a page of labels, such as address labels. Creating labels requires you to create a report design document representing a single label and a report application that prints multiple labels on a page.

Create the report design document

The report design document (.4rp) contains the design for a single label. You can put anything you wish on the label, as long as it fits onto the page.

See Design labels for details on creating the single-label report design document (.4rp).

Update your report application

Once the label is defined in a report design document, you update your report application so that it outputs the data needed for a label within ON EVERY ROW in the REPORT block, and it tells the report engine to output multiple labels onto a single physical page.
  • In the FORMAT section of the REPORT program block, output the data needed for the label ON EVERY ROW.
  • Configure the report engine for labels using Reporting API functions.
    • fgl_report_selectLogicalPageMapping allows you to specify that this report will create a page of labels.
    • fgl_report_setPaperMargins sets the margins (top, bottom, left, right).
    • fgl_report_configureLabelOutput configures the physical layout of the label page using these parameters:
      • paper Width
      • paper Height
      • label Width (set to null)
      • label Height (set to null)
      • number of labels per row
      • number of labels per column

Example

This example uses the OrderLabels.4rp report design document from the Reports GRW demo.

In the SimpleReport BDL program, the MAIN program block that configures the report engine is changed as follows:

  -- configure report engine; the functions prefixed fgl that are called here
  -- are part of the Reporting API
  IF fgl_report_loadCurrentSettings("OrderLabels.4rp") THEN   -- load the labels
                                                     -- design document (4rp file)
    -- special settings for labels
    CALL fgl_report_selectLogicalPageMapping("labels")
    CALL fgl_report_setPaperMargins("5mm","5mm","4mm","4mm")
    CALL fgl_report_configureLabelOutput("a4width","a4length",null,null,2,6)
  END IF
  LET handler = fgl_report_commitCurrentSettings() -- commit changes

The rest of the SimpleReport program would remain unchanged. This example would print two labels across and six labels down per page.

Figure: Output of labels on a physical page


This figure shows an example of output from a report configured to create Labels.