dlgEvent_RelationName_BeforeRunningReport
Function called to configure the report.
Syntax
PUBLIC FUNCTION dlgEvent_Relation_BeforeRunningReport(
reportAction SMALLINT,
printSettings PrintSettings_Type)
RETURNS (INTEGER, STRING)
The function parameters are:
reportAction SMALLINT
. This sets the action for the report.SMALLINT
is one of the four actions defined by the libdbappReportUI.4gl file:Description Constant Value Print C_REPORT_ACTION_PRINT 1 Preview C_REPORT_ACTION_PREVIEW 2 Export C_REPORT_ACTION_EXPORT 3 Cancel C_REPORT_ACTION_CANCEL 4 printSettings PrintSettings_Type
. Sets the printer and output settings for the report.PrintSettings_Type
is one of the two settings defined by the libdbappReportCore.4gl file.PUBLIC TYPE PrintSettings_Type RECORD r_printer STRING, --One of :"ShowPrintDialog", "PrintOnDefaultPrinter", <Server printer name> r_output STRING --One of :"Printer", "PDF", "Image", "SVG" , "HTML", "XLS" END RECORD
Usage
This function is used to configure the printing output of reports by using the libdbapp API or directly with the GRE API.
When selecting print, the default settings are;
reportAction = C_REPORT_ACTION_PRINT
printSettings = {NULL, NULL}
printSettings = {NULL, NULL}
defaults to the ShowPrintDialog
value.You can override the behaviour by removing the following line before the code
event:
CALL libdbapp_report_configure(reportAction, printSettings) RETURNING errNo, errMsg
Example
The following example ensures to use the default printer for your device.
PUBLIC FUNCTION dlgEvent_Relation1_BeforeRunningReport(reportAction SMALLINT, printSettings PrintSettings_Type) RETURNS (INTEGER, STRING)
DEFINE errNo INTEGER = ERROR_SUCCESS
DEFINE errMsg STRING
CALL libdbappCore.log(C_LOG_INFO, "dlgEvent_Relation1_BeforeRunningReport (BA Relation scope) is raised")
-- By default, report is already configured with these parameters.
-- You can override reportAction and printSettings and use
LET printSettings.r_printer = "PrintOnDefaultPrinter" -- Change the default settings
CALL libdbapp_report_configure(reportAction, printSettings) RETURNING errNo, errMsg -- Apply new settings
RETURN errNo, errMsg
END FUNCTION