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
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 theREPORT
program block, output the data needed for the labelON EVERY ROW
. - Configure the report engine for labels using Reporting API functions.
gl_report_selectLogicalPageMapping("labels")
specifies that this report creates a page of labels.fgl_report_setPaperMargins (top, bottom, left, right)
sets the margins.fgl_report_configureLabelOutput (paperWidth, paperHeight, labelWidth, labelHeight, labelsPerRow, labelsPerColumn)
configures the physical layout of the label page. Set label width and label height tonull
.
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:
- Loads OrderLabels.4rp as the Report Design Document
- The function
fgl_report_selectLogicalPageMapping
specifies the format of the page as "labels". - The function
fgl_report_setPaperMargins
sets the top and bottom margins to 5mm, and the left and right margins to 4mm. - Function
fgl_report_configureLabelOutput
sets the paper width and height to A4, and specifies two rows and six columns.
-- 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.