Kbase P59442: How to call results from 4GL and send the report to a file ?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  03/11/2005 |
|
Status: Unverified
GOAL:
How to call results from 4GL and send the report to a file ?
FACT(s) (Environment):
Windows
Progress 9.x
Progress 8.x
FIX:
Create your reports using Query/Results.
After the report is done select an export format using Query->Site Admin->Standard Export.
Select prefered format from the list.
Generate the report ( .p file ) using Query->Generate ...
VERY IMPORTANT: Open the generated file and comment out the "OUTPUT TO ..." statement if any.
Create and compile the following rptcaller.p 4GL procedure which is the main caller for your reports.
/*rptcaller.p starts here */
DEFINE NEW SHARED VARIABLE qbf-total AS INTEGER INITIAL 0 NO-UNDO.
DEF VAR vcdel AS CHAR INIT '&'.
DEF VAR rpt AS CHARACTER.
DEF VAR fout AS CHARACTER.
DEF VAR vc AS CHARACTER.
vc = SESSION:PARAMETER.
rpt = ENTRY( 1, vc, vcdel ).
IF SEARCH( rpt ) = ? THEN DO:
MESSAGE "Invalid report name " rpt VIEW-AS ALERT-BOX.
RETURN.
END.
IF NUM-ENTRIES( vc, vcdel ) > 1 THEN
fout = ENTRY( 2, vc, vcdel ).
ELSE
fout = "unknown.txt".
OUTPUT TO VALUE( fout ) PAGED.
RUN VALUE( rpt ).
OUTPUT CLOSE.
QUIT.
/*rptcaller.p ends here */
Create rptcaller.bat script as follows ( this will be called in task scheduler ) :
/* rptcaller.bat starts here */
@echo off
set DLC=<put your DLC here>
set PATH=%DLC%\bin;%PATH%
prowin32 -b -db <your database here> -p rptcaller.p -param "%1&%2"
/* rptcaller.bat ends here */
/* use the following command in task schedule */
rptcaller.bat custrpt.p c:\myfolder\output.txt
where custrpt.p is the procedure generated from results
c:\myfolder\output.p is the output file where report is sent