Official Content

GeneXus provides developers with a solid set of printing commands to generate reports easily and comfortably. This set of commands, which is listed in the table below, is used in Procedures to control and send printing jobs.

A description of each command is provided in the table below, to help you understand what they do:

Printpage Scheme

 

CP Defines whether to continue printing on the same page or jump to the next one, depending on the lines remaining in the printable area (text-mode only).
Eject Sets a page break.
Footer Sets the footer lines to be printed at the bottom of each page.
Header Defines what is going to be printed as the header of each page.
Lineno Defines the line number where the following line will be printed. If the number is less than the current line, a page break is made.
MB Defines the number of lines that will make up the bottom margin of the report.
MT Defines the number of lines that will make up the upper margin of the report.
NoSkip Avoids skipping a line.
PL Sets the maximum number of lines per page (text-mode only).
Print Sends a complete print block to the report's output media.

The Measurement unit used is the User Space Units. This User space unit is approximately the same as the unit used in the printing industry which is the Point (pt) unit.
1 inch = 25.4 mm = 72 user units

Example

This example explains how to obtain a statistical report of all the crew members of an airline whose ages are in a given range, and whose ranks (Commander, Copilot, etc.) also match a given grade. These values are received by parameters through previously requested variables.

Since the process of accessing the database and selecting the data is carried out as follows:

For each order CrewLastName
       where CrewAge >= &AgeFrom
       where CrewAge <= &AgeTo
       where CrewRank = &Rank
       ...
EndFor

...and it is used in many places (reports, processes, etc.) in the project, a Data Selector object has been programmed as a navigation object that can be reused from other objects. This Data Selector, called CrewPerAgeRanks, has the following structure:

Printing DS

The following group of print blocks has been designed within the Procedure object called AgesAndRanks:

Printing Proc

The following rules have been applied to the procedure:

Printing Rules

Lastly, the following source code has been programmed:

Printing Source

The first group of lines sets the margins and length of the page, in lines. Next is the Header group, which is accessed by GeneXus only when a start page is detected. The body made up by only one line, prints the Header print block. The same happens with the Footer group, which is accessed when a page change is detected.

Note that the Data Selector object is used in the relevant For Each group. Whenever valid information is found, it will be printed in the body of the For Each.

Basic Considerations

To obtain the output report, remember that:

  • The Main program property must be "True".
  • The Call protocol property must be "HTTP".
  • You need write the rule "Output_File('reportname','PDF');".

When using a Graphic format such as PDF is not supported by the PL command. To get a custom report, modify the Paper Width and Paper Height Procedure's layout properties and use MT and MB commands when needed.




Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant