Skip to main content
Version: Next

PRINT RECORD

PRINT RECORD ( {aTable}{;}{* | >} )

ParameterTypeDescription
aTableTableTable for which to print the current record or Default table if omitted
* | >Operator* to suppress the printing dialog box, or > to not reinitialize print settings

This command is not thread-safe, it cannot be used in preemptive code.

Description

PRINT RECORD prints the current record of aTable, without modifying the current selection. The current output form is used for printing. If there is no current record for aTable, PRINT RECORD does nothing.

You can print subforms with the PRINT RECORD command. This is not possible with Print form.

Note: If there are modifications to the record that have not been saved, this command prints the modified field values, not the field values located on disk.

By default, PRINT RECORD displays the Print job dialog box before printing. If the user cancels the dialog box, the command is canceled and the record is not printed. You can suppress this dialog box by using either the optional asterisk (*) parameter or the optional “greater than” (>) parameter:

  • The * parameter causes a print job using the current print parameters (default parameters or those defined by the _o_PAGE SETUP and/or SET PRINT OPTION commands).
  • Furthermore, the > parameter causes a print job without reinitializing the current print parameters. This setting is useful for executing several successive calls to PRINT RECORD (e.g. inside a loop) while maintaining previously set customized print parameters.

4D Server: This command can be executed on 4D Server in a stored procedure. In this context:

  • Make sure that no dialog box appears on the server machine (except for a specific requirement). To do this, it is necessary to call the command with the * or > parameter.
  • In the case of a problem concerning the printer (out of paper, printer disconnected, etc.), no error message is generated.

Warning: Do not use the PAGE BREAK command with PRINT RECORD. PAGE BREAK is exclusively reserved for use in combination with the Print form command.

Example 1

The following example prints the current record of the [Invoices] table. The code is contained in the object method of a Print button on the input form. When the user clicks the button, the record is printed using an output form designed for this purpose.

 FORM SET OUTPUT([Invoices];"Print One From Data Entry") // Select the right output form for printing
 PRINT RECORD([Invoices];*) // Print Invoices as it is (without showing the printing dialog boxes)
 FORM SET OUTPUT([Invoices];"Standard Output") // Restore the previous output form

Example 2

The following example prints the same current record in two different forms. The code is contained in the object method of a Print button on the input form. You want to set customized print parameters and then use them in the two forms.

 PRINT SETTINGS //User defines print parameters
 If(OK=1)
    FORM SET OUTPUT([Employees];"Detailed") //Use the first print form
    PRINT RECORD([Employees];>) //Print using user-defined parameters
    FORM SET OUTPUT([Employees];"Simple") //Use the second print form
    PRINT RECORD([Employees];>) //Print using user-defined parameters
    FORM SET OUTPUT([Employees];"Output") //Restore default output form
 End if

See also

Print form