Consultor Eletrônico



Kbase 20907: RB. Running a Report Builder Report on the Progress AppServer
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/9/2005
Status: Verified

GOAL:

Running a Report Builder Report on the Progress Appserver

GOAL:

How to setup Report Builder on an AppServer?

FIX:

The procedure leaves resources available on the client side because the Appserver handles all the processes.

It can use Synchronous or Asynchronous Appserver.

There are two request types:
- Synchronous request.

The client blocks and waits for the result of the remote request before it continues execution.

- Asynchronous request.

The client continues execution after it initiates the request, and processes the result whenever the Appserver makes the result available.

The following example uses Progress Version 9.x. Follow these steps:

1) Start the Database with the start up parameters -S (service1) -H (hostname) -N TCP.

2) Start the Appserver using the Service Name (service2).

3) The .prl file should be in the Appserver work directory.

4) Modify the procedure "ConnectApp.p" and execute from the client.

This procedure connects to the Appserver and calls the Report Engine procedure "printreport.p". The "printreport.p" should be in the Appserver work directory.

The following is client side example code to execute the Report Builder Engine on the Progress Appserver Synchronous:

/*ConnectApp.p*/

DEFINE VARIABLE h-appsrv AS HANDLE NO-UNDO.
DEFINE VARIABLE status AS LOGICAL NO-UNDO.
DEFINE VARIABLE connectpar AS CHAR NO-UNDO INIT "-AppService
(appservername) -S (service2) -H (hostname) -N TCP".
DEFINE VARIABLE h AS HANDLE NO-UNDO.

CREATE SERVER h-appsrv.
status = h-appsrv:CONNECT(connectpar).

IF NOT status THEN
MESSAGE "Could not connect to AppServer" SKIP
"using connect-string: " SKIP connects SKIP VIEW-AS ALERT-BOX.
ELSE DO:
RUN printreport.p PERSISTENT SET h ON h-appsrv TRANSACTION
DISTINCT.
status = h-appsrv:DISCONNECT().
END.

DELETE OBJECT h-appsrv.


The following client side example executes the Report Builder Engine on the Progress Appserver Asynchronous.

/* ConnectApp.p*/
DEF VAR h-appsrv AS HANDLE NO-UNDO.
DEF VAR status AS LOGICAL NO-UNDO.
DEF VAR connectpar AS CHAR NO-UNDO INIT "-AppService (appservername)
-S (service2) -H (hostname) -N TCP".
DEF VAR h AS HANDLE NO-UNDO.

CREATE SERVER h-appsrv.
status = h-appsrv:CONNECT(connectpar).

IF NOT status THEN
MESSAGE "Could not connect to AppServer" SKIP
"using connect-string: " SKIP connects SKIP VIEW-AS ALERT-BOX.
ELSE DO:
RUN printreport.p ASYNCHRONOUS SET h EVENT-PROCEDURE "proasyn"
IN THIS-PROCEDURE ON SERVER h-appsrv.

WAIT-FOR PROCEDURE-COMPLETE OF h.

status= h-appsrv:DISCONNECT().
END.
END.

PROCEDURE proasyn:
MESSAGE "Report ready" VIEW-AS ALERT-BOX.
END.

The following AppServer side code calls the Report Builder Engine for the Progress AppServer:

/*printreport.p*/
RUN aderb\_printrb(
"AppServer.prl", /* RB-REPORT-LIBRARY */
"test", /* RB-REPORT-NAME */
"", /* RB-DB-CONNECTION */
"", /* RB-INCLUDE-RECORDS */
"", /* RB-FILTER */
"", /* RB-MEMO-FILE */
"", /* RB-PRINT-DESTINATION */
"\\printer path and name", /* RB-PRINTER-NAME */
"", /* RB-PRINTER-PORT */
"", /* RB-OUTPUT-FILE */
1, /* RB-NUMBER-COPIES - zero */
1, /* RB-BEGIN-PAGE - zero */
99, /* RB-END-PAGE - zero */
NO, /* RB-TEST-PATTERN */
"Report", /* RB-WINDOW-TITLE */
NO, /* RB-DISPLAY-ERRORS */
NO, /* RB-DISPLAY-STATUS */
YES, /* RB-NO-WAIT */
""). /* RB-OTHER-PARAMETERS */

NOTE: The _prntrb2 can be used instead of _printrb as shown in the following:

RUN aderb\_prntrb2(
"AppServer.prl", /* RB-REPORT-LIBRARY */
"test", /* RB-REPORT-NAME */
"", /* RB-DB-CONNECTION */
"", /* RB-INCLUDE-RECORDS */
"", /* RB-FILTER */
"", /* RB-MEMO-FILE */
"", /* RB-PRINT-DESTINATION */
"\\printer path and name", /* RB-PRINTER-NAME */
"", /* RB-PRINTER-PORT */
"", /* RB-OUTPUT-FILE */
1, /* RB-NUMBER-COPIES - zero */
1, /* RB-BEGIN-PAGE - zero */
99, /*. RB-END-PAGE - zero */
NO, /* RB-TEST-PATTERN */
"Report", /* RB-WINDOW-TITLE */
NO, /* RB-DISPLAY-ERRORS */
NO, /* RB-DISPLAY-STATUS */
YES, /* RB-NO-WAIT */
"", /* RB-OTHER-PARAMETERS */
"status.txt"). /* RB-STATUS-FILE */

Do not forget to add the 20th parameter RB-STATUS-FILE.

NOTE: The printer should be set in the AppServer machine. If there is any problem with the printer on a Windows NT platform, see Progress Solution 18501, "Program Run on V9 AppServer on NT platform Cannot Print"..