Focal Point
[CLOSED] How to loop a COMPOUND PDF Report

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

March 21, 2016, 01:37 PM
Ricardo Augusto
[CLOSED] How to loop a COMPOUND PDF Report
Hi,

I need some help to implement a LOOP to show few COUMPOUND PDF reports. The number of COMPONENTs will be dynamic.

Can anyone help me?

  

-* File: IBFS:/WebFOCUS 8X DEV/WFC/Repository/vesir218/std_reports/dev/Procedure1.fex Created by WebFOCUS AppStudio
SET ASNAME=ON
SET CENT-ZERO=ON
SET CDN=ON

-SET &ECHO=ALL;


-SET &CTR = 0;
-SET &COUNTRY='X';



TABLE FILE CAR
BY COUNTRY
ON TABLE HOLD AS H1 FORMAT ALPHA
END

-SET &HOWMANY = &LINES ;
-REPEAT ENDLOOP FOR &CTR FROM 1 TO &HOWMANY
-READFILE H1 

-SET &PAIS=LTRIM(RTRIM(&COUNTRY));


-RUN

-*
-*-* START PDF COMPOUND SECTION

SET HTMLARCHIVE=ON
COMPOUND LAYOUT PCHOLD FORMAT PDF AS LOOP_COMPOUND
UNITS=PTS, $
SECTION=section1, LAYOUT=ON, METADATA='5^5^5^5^4', MERGE=OFF, ORIENTATION=LANDSCAPE, PAGESIZE=LETTER, SHOW_GLOBALFILTER=OFF, $

PAGELAYOUT=ALL, $

PAGELAYOUT=&CTR, NAME='&CTR', text='&CTR', TOC-LEVEL=1, TOPMARGIN=1, ORIENTATION=LANDSCAPE, $
COMPONENT='&PAIS', TEXT='&PAIS', POSITION=(+1 +80), DIMENSION=(* *),  $


END


SET COMPONENT=&PAIS

-RUN

TABLE FILE CAR
SUM
SALES/D10
BY MODEL
IF COUNTRY EQ '&PAIS'
ON TABLE SUBHEAD
"SALES FROM &PAIS &CTR"
""
ON TABLE COLUMN-TOTAL
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=REPORT,
SIZE=4,
$
ENDSTYLE
END


-ENDLOOP
-ENDREPEAT



-EXIT

This message has been edited. Last edited by: Kathleen Butler,


WebFOCUS 8.1.05 / APP Studio
March 23, 2016, 10:55 AM
Ricardo Augusto
Frowner


WebFOCUS 8.1.05 / APP Studio
March 23, 2016, 11:45 AM
Tony A
Ricardo,

The thing you have to remember about the newer compound syntax is that it basically consists of two sections which have to be presented in the correct order.

The first is the "compound layout" and will consist of the page layout with all the components in the order that they will be given in the second section.

The second section is the "components" and will consist of all the components in the order in which they appear in the layout section. The first line will be a declaration of the component (SET COMPONENT=...).

So if you comprehend this then one way you could achieve this is by writing out the two sections into separate files and then -INCLUDE filename.

Should be straight forward to code.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
March 23, 2016, 11:59 AM
Tony A
So basically, using your code as a base - e.g. not syntax checked etc.

You would get something like the following. Just refine the output shown by the CMD TYPE statements until you know that you've not got an unending loop process etc. and that the compound syntax is just right for your needs. Then comment out the CMD TYPE statements and uncomment the -INCLUDE statements.

T

FILEDEF LAYOUT DISK LAYOUT.FEX
FILEDEF CMPNTS DISK COMPONENTS.FEX
-RUN

-WRITE LAYOUT SET HTMLARCHIVE=ON
-WRITE LAYOUT COMPOUND LAYOUT PCHOLD FORMAT PDF AS LOOP_COMPOUND
-WRITE LAYOUT UNITS=PTS, $
-WRITE LAYOUT SECTION=section1, LAYOUT=ON, METADATA='5^5^5^5^4', MERGE=OFF, ORIENTATION=LANDSCAPE, PAGESIZE=LETTER, SHOW_GLOBALFILTER=OFF, $
-WRITE LAYOUT 
-WRITE LAYOUT PAGELAYOUT=ALL, $
-WRITE LAYOUT 
-WRITE LAYOUT PAGELAYOUT=1, NAME='Layout1', text='Layout1', TOC-LEVEL=1, TOPMARGIN=1, ORIENTATION=LANDSCAPE, $
-WRITE LAYOUT 

TABLE FILE CAR
BY COUNTRY
ON TABLE HOLD AS TEMPHLD1
END
-RUN

FILEDEF LAYOUT DISK LAYOUT.FEX (APPEND
-RUN

-READFILE TEMPHLD1
-REPEAT :Loop WHILE &IORETURN EQ 0;
-SET &Country = TRUNCATE(&COUNTRY);

-WRITE LAYOUT COMPONENT='&Country', TEXT='&Country', POSITION=(+1 +80), DIMENSION=(* *),  $

-WRITE CMPNTS SET COMPONENT=&Country.QUOTEDSTRING
-WRITE CMPNTS -RUN
-WRITE CMPNTS TABLE FILE CAR
-WRITE CMPNTS SUM SALES/D10
-WRITE CMPNTS BY MODEL
-WRITE CMPNTS IF COUNTRY EQ '&Country'
-WRITE CMPNTS ON TABLE SUBHEAD
-WRITE CMPNTS "SALES FROM &Country"
-WRITE CMPNTS ""
-WRITE CMPNTS ON TABLE COLUMN-TOTAL
-WRITE CMPNTS ON TABLE SET PAGE-NUM NOLEAD
-WRITE CMPNTS ON TABLE PCHOLD FORMAT PDF
-WRITE CMPNTS ON TABLE SET STYLE *
-WRITE CMPNTS TYPE=REPORT, SIZE=4, $
-WRITE CMPNTS ENDSTYLE
-WRITE CMPNTS END
-WRITE CMPNTS -RUN

-READFILE TEMPHLD1

-:Loop

-WRITE LAYOUT END

CMD TYPE LAYOUT.FEX
CMD TYPE COMPONENTS.FEX
-*-INCLUDE LAYOUT.FEX
-*-INCLUDE COMPONENTS.FEX




In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10