Kbase 16953: Example of Using Actuate API to Run Report from 4GL
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Verified
GOAL:
How to use the Actuate Results Application Programming Interface (API) to run a report from the Progress 4GL.
FACT(s) (Environment):
Actuate 4.0
Actuate 4.1
FIX:
In this example, you must specify the name of the report (.rov file) and whether or not to view the report on screen or print it to a printer.
There are many options you might want to control when you run a report using API.
For information on these options, refer to the Actuate Application Programming Interface Guide.
/*------------------------------------------------------------------*/
/* The following is a simple example of using the Actuate API to */
/* run a report from the Progress 4gl. In this example, you must */
/* specify the name of the report (.rov file) and whether to view */
/* the report on screen or print to a printer. */
/*------------------------------------------------------------------*/
&GLOBAL-DEFINE AC-REQ-VIEW 4 /* View Report */
&GLOBAL-DEFINE AC-REQ-PRINT 8 /* Print Report */
DEFINE VARIABLE chrName AS CHARACTER NO-UNDO.
DEFINE VARIABLE chrDestination AS CHARACTER NO-UNDO.
DEFINE VARIABLE intInterfaceHandle AS INTEGER NO-UNDO.
DEFINE VARIABLE intOptions AS INTEGER NO-UNDO INITIAL 0.
DEFINE VARIABLE intResult AS INTEGER NO-UNDO.
/*------------------------------------------------------------------*/
/* Name of the report to be run and the destination (VIEW or PRINT) */
/* !!You must insert the path and name of a valid .rov file below!! */
/*------------------------------------------------------------------*/
ASSIGN chrName = "<SomePathAndFileName.ROV>"
chrDestination = "VIEW".
/*------------------------------------------------------------------*/
/* Initialize the Actuate API Interface */
/*------------------------------------------------------------------*/
RUN AcReqInitialize (OUTPUT intInterfaceHandle).
/*------------------------------------------------------------------*/
/* Determine if the report is viewed or printed */
/*------------------------------------------------------------------*/
CASE chrDestination:
WHEN "VIEW" THEN
ASSIGN intOptions = intOptions + {&AC-REQ-VIEW}.
WHEN "PRINT" THEN
ASSIGN intOptions = intOptions + {&AC-REQ-PRINT}.
OTHERWISE
DO:
MESSAGE "Invalid Print Destination" VIEW-AS ALERT-BOX.
RETURN.
END.
END CASE.
/*------------------------------------------------------------------*/
/* Run the report and remove the dll from memory */
/*------------------------------------------------------------------*/
RUN AcReqGenerateReport (chrName, intOptions, 0, OUTPUT intResult).
RUN AcReqUnInitialize (intInterfaceHandle, OUTPUT intResult).
/*------------------------------------------------------------------*/
/* External Procedure Definitions From REQST32.DLL */
/* */
/* These Definitions assume that REQST32.DLL can be found by */
/* MS-Windows by searching the PATH environment variable */
/*------------------------------------------------------------------*/
PROCEDURE AcReqInitialize EXTERNAL "REQST32.DLL" PERSISTENT:
DEFINE RETURN PARAMETER intReturn AS LONG.
END PROCEDURE.
PROCEDURE AcReqGenerateReport EXTERNAL "REQST32.DLL" PERSISTENT:
DEFINE INPUT PARAMETER chrFileName AS CHARACTER.
DEFINE INPUT PARAMETER intOptions AS LONG.
DEFINE INPUT PARAMETER intFileNumber AS LONG.
DEFINE RETURN PARAMETER intReturn AS LONG.
END PROCEDURE.
PROCEDURE AcReqUnInitialize EXTERNAL "REQST32.DLL":
DEFINE INPUT PARAMETER intHandle AS LONG.
DEFINE RETURN PARAMETER intReturn AS SHORT.
END PROCEDURE.