Focal Point
[SOLVED] Multiple compound PDF files in a read loop

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7931088331

July 26, 2005, 07:42 PM
pruittlr
[SOLVED] Multiple compound PDF files in a read loop
Using WF 5.33 on Windows 2000.

In the same program I had the -REPEAT question, I have another one related to multiple PDF files being generated.

Basic code:
-REPEAT ...
-READ ...
SET COMPOUND = OPEN
TABLE FILE FN
....
ON TABLE PCHOLD AS PDF
END
SET COMPOUND = CLOSE
TABLE FILE FN
....
ON TABLE PCHOLD AS PDF
END

Instead of using PCHOLD, I want to hold/save each compound file as a unique name on my server.
Something like this.

-REPEAT ...
-READ ...
-SET PRTFN = &VAR1||&VAR2;
-* var1 & var2 comes from the file read

SET COMPOUND = OPEN
TABLE FILE FN
....
ON TABLE HOLD AS PDF
END
SET COMPOUND = CLOSE
TABLE FILE FN
....
ON TABLE PCHOLD AS &PRTFN
END

This is not working, I only get the first report in the brower. It won't save it to the server.

Anyone got any ideas how to hold/save each PDF report as a unique name and have the loop continued, doing the next read and hold?

Thanks,
Raelene

This message has been edited. Last edited by: Kerry,
July 26, 2005, 07:56 PM
mgrackin
ON TABLE HOLD FORMAT PDF would be the correct syntax. AS PDF just names it 'PDF'.
July 26, 2005, 08:56 PM
pruittlr
Ooops, that was a typo. I knew that part.

The part I'm having trouble with is saving the compound report as a unique name to the server under a specific directory. The PDF files will be picked up by another software/person for printing. Since the compound report consists of two PDF reports, I can't figure out how to save them to the server because there are two names (one for the first table file, the second for the second table file). Does this make more sense?
July 26, 2005, 09:17 PM
Francis Mariani
Add a FILEDEF command for the PDF reports you want saved on the server. Put the FILEDEF within the loop.

-SET &FILE_NAME = 'c:\some\where\on\the\server\' | &PRTFN || '.pdf';
FILEDEF &PRTFN DISK &FILE_NAME
-RUN
August 03, 2005, 09:19 PM
pruittlr
This is the resolution in case anyone needs it.

-** Set up error
-SET &CTR=0;
-** Initialize IORETURN for the Repeat Loop
-SET &IORETURN = 0;
-*** Set up the file name and file def for the external file.
-SET &FILE_NAME='D:\PATHNAME\DATA.DAT';
FILEDEF FN DISK &FILE_NAME
-RUN
-********************
-**** START LOOP ****
-********************
-REPEAT :END_LOOP WHILE &IORETURN EQ 0;
-***** read in input data from external file *****
-READ AS_PRINT,NOCLOSE &VAR1 &VAR2 &VAR3
-IF &IORETURN NE 0 GOTO :END_LOOP;
-*********************************************************************
-*** Set up file def for compound PDF hold file.
-*** Each report will be saved to the server with a unique file name.
-*********************************************************************
-** Add 1 to counter, this is part of the PDF file name.
-SET &CTR = &CTR + 1;
-SET &PRT_FLNM='AS_'||&CTR||'.PDF';
-SET &HOLDAS = 'AS_'||&CTR;
FILEDEF &HOLDAS DISK D:\PATHNAME\&PRT_FLNM
-RUN
-*** create report1
TABLE FILE FILENAME1
PRINT...
ON TABLE HOLD AS &HOLDAS FORMAT PDF OPEN
END
-RUN
-*** create report2
TABLE FILE FILENAME2
PRINT ...
ON TABLE HOLD AS &HOLDAS FORMAT PDF CLOSE
END
-RUN
-:END_LOOP
-**********************
-**** END OF LOOP ****
-**********************
October 08, 2010, 02:34 PM
Ted Michalski
I want to display two PDF's in the browser from a compound report, not save them to a server. Is this possible?


7.7.02
Windows
EXCEL, PDF, CSV, TEXT
October 08, 2010, 04:28 PM
GamP
You mean two different PDF documents in one browser instance?
Don't know if that's possible, never seen it done.
But maybe it can be done if you have two iframes on the page and populate each one with it's own pdf. Really no idea if that might work.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
October 09, 2010, 12:29 AM
Francis Mariani
If it's a compound report, it's one PDF file.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 12, 2010, 02:10 AM
<JG>
Depending on your browser settings this will open the PDFs either in the frames
or will open 2 acrobat documents. Note the PDF outputs must be saved to a webserver readable location

 APP FI PDF1 DISK baseapp/PDF1.PDF
APP FI PDF2 DISK baseapp/PDF2.PDF
-RUN
TABLE FILE CAR
BY COUNTRY
ON TABLE HOLD AS PDF1 FORMAT PDF
END
-RUN
TABLE FILE CAR
BY CAR
ON TABLE HOLD AS PDF2 FORMAT PDF
END
-RUN
-HTMLFORM BEGIN
<HTML>
<body>
<iframe src='http://localhost:9090/approot/baseapp/pdf1.pdf'>
</iframe>
<iframe  src='http://localhost:9090/approot/baseapp/pdf2.pdf'>
</iframe>
</body>
</html>
-HTMLFORM END