Focal Point
Breaking table on ACROSS field?

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

May 11, 2012, 10:19 AM
Wep5622
Breaking table on ACROSS field?
I have a table similar to this one:
TABLE FILE CAR
SUM DEALER_COST SALES
ACROSS COUNTRY AS 'Car'
ACROSS CAR AS ''
BY SEATS AS 'Month' ROWS 1 OVER 2 OVER 3 OVER 4 OVER 5 OVER 6 OVER 7 OVER 8 OVER 9 OVER 10 OVER 11 OVER 12
END


The output is PDF on an A4 format page (landscape), but the page isn't wide enough to fit the table. This report is part of a compound report, which doesn't seem to be able to deal with reports that span multiple pages horizontally!

Hence, I would like to break my table on COUNTRY, but I don't know how to do that.

The result would be a series of tables, with 12 rows each (12 months) and column headings:
   ENGLAND
   JAGUAR JENSEN TRIUMPH
 1 ...
 2
...
12

In the 2nd table:
FRANCE
PEUGEOT

In the 3rd table:
ITALY
ALFA ROMEO MASERATI


...etc.

Can this be done?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
May 13, 2012, 04:30 PM
Waz
This is a difficult one.

I would suggest numbering the countries/Cars, 1-n.

Then Assign the numbers to columns.

Use this column number for the across

And finally put the titles in the heading.

A bit of work, but can be done.

The only other way I can think of doing this would be to create a loop and produce one "Panel" of data at a time in the compound report


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

May 13, 2012, 05:37 PM
Tony A
You could multi-pass your data but that may not be best for the amount of data that you have. It will depend upon the number of breaks that you wish to have, however, it may be the solution you want.

TABLE FILE CAR
BY COUNTRY
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS CTRIES
END
-RUN
-SET &CtyrCount = &LINES;

-READ CTRIES NOCLOSE &Country.10
-REPEAT :Loop WHILE &IORETURN EQ 0;
TABLE FILE CAR
  SUM DEALER_COST
      SALES
ACROSS COUNTRY AS 'Car'
ACROSS CAR AS ''
    BY SEATS AS 'Month' ROWS 1 OVER 2 OVER 3 OVER 4 OVER 5 OVER 6
	                    OVER 7 OVER 8 OVER 9 OVER 10 OVER 11 OVER 12
WHERE COUNTRY EQ &Country.QUOTEDSTRING
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
  GRID=OFF, SIZE=9, $
ENDSTYLE
END
-RUN
-READ CTRIES NOCLOSE &Country.10
-:Loop

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 
May 14, 2012, 08:15 AM
Wep5622
quote:
Originally posted by Waz:
This is a difficult one.

I would suggest numbering the countries/Cars, 1-n.

Then Assign the numbers to columns.

Use this column number for the across

And finally put the titles in the heading.

A bit of work, but can be done.


I must be missing something, how does that result in multiple tables?

EDIT: Oh wait, I think I see where you're going! The column numbers mean I only get relevant ACROSS-columns per COUNTRY/CAR, while I then can group by COUNTRY and put appropriate heading labels in a SUBHEAD on COUNTRY. Sounds easier than it is, but yeah...

This message has been edited. Last edited by: Wep5622,


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
May 14, 2012, 08:35 AM
Wep5622
quote:
Originally posted by Tony A:
You could multi-pass your data but that may not be best for the amount of data that you have. It will depend upon the number of breaks that you wish to have, however, it may be the solution you want.


I think it is. I'm running into two problems with this solution though:


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
May 14, 2012, 03:57 PM
Tony A
Not sure how you are coding the compound doc but try this (which works) -

Place this in a focexec within your app path, and name it wep_compound_rep -

-* File wep_compound_rep.fex
TABLE FILE CAR
  SUM DEALER_COST
      SALES
ACROSS COUNTRY AS 'Car'
ACROSS CAR AS ''
    BY SEATS AS 'Month' ROWS 1 OVER 2 OVER 3 OVER 4 OVER 5 OVER 6
	                    OVER 7 OVER 8 OVER 9 OVER 10 OVER 11 OVER 12
WHERE COUNTRY EQ &Country.QUOTEDSTRING
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
  GRID=OFF, SIZE=9, $
ENDSTYLE
END
-RUN

Then create a new fex called wep_compound_ctrl and place this code within it.
TABLE FILE CAR
BY COUNTRY
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS CTRIES
END
-RUN

SET HTMLARCHIVE=ON
COMPOUND LAYOUT PCHOLD FORMAT PDF
UNITS=IN, $
SECTION=section1, LAYOUT=ON, MERGE=OFF, ORIENTATION=PORTRAIT, PAGESIZE=A4, SHOW_GLOBALFILTER=OFF, $
-REPEAT :Loop1 FOR &Cnt FROM 1 TO &LINES;
PAGELAYOUT=&Cnt.EVAL, NAME='Page layout &Cnt.EVAL', text='Page layout &Cnt.EVAL', TOC-LEVEL=1, BOTTOMMARGIN=0.5, TOPMARGIN=0.5, $
COMPONENT='report&Cnt.EVAL', TEXT='report&Cnt.EVAL', TOC-LEVEL=2, POSITION=(0.521 0.521), DIMENSION=(7.500 *), $
-:Loop1
END

-SET &Cnt = 1;
-READ CTRIES NOCLOSE &Country.10
-REPEAT :Loop2 WHILE &IORETURN EQ 0;
SET COMPONENT='report&Cnt.EVAL'
-INCLUDE wep_compound_rep.fex
-SET &Cnt = &Cnt + 1;
-READ CTRIES NOCLOSE &Country.10
-:Loop2
COMPOUND END

Now run the wep_compound_ctrl and you should have the report required.

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 
May 14, 2012, 05:38 PM
Waz
quote:
EDIT: Oh wait, I think I see where you're going!


Ah, thank the FOCUS Gods, I thought I was way up the wrong creek.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

May 16, 2012, 02:50 PM
Dan Satchell
This approach only works in release 7.7 (because of HIDENULLACRS), and only with PAGE-BREAK on COUNTRY.

TABLE FILE CAR
 SUM
  DEALER_COST
  SALES
  COMPUTE COL_NUM/I5 = IF (COUNTRY NE LAST COUNTRY) THEN 1 ELSE (LAST COL_NUM + 1);
 BY COUNTRY
 BY CAR
 BY SEATS
 ON TABLE HOLD AS CARHOLD
END
-*
TABLE FILE CARHOLD
 SUM
  DEALER_COST
  SALES
 BY COUNTRY NOPRINT PAGE-BREAK
 BY SEATS AS 'Month' ROWS 1 OVER 2 OVER 3 OVER 4 OVER 5 OVER 6 OVER 7 OVER 8 OVER 9 OVER 10 OVER 11 OVER 12
 ACROSS COUNTRY AS 'Country / Car'
 ACROSS COL_NUM NOPRINT
 ACROSS CAR AS ''
 ON TABLE SET ORIENTATION LANDSCAPE
 ON TABLE SET HIDENULLACRS ON
-* ON TABLE SET ACROSSTITLE SIDE
 ON TABLE PCHOLD FORMAT PDF
END



WebFOCUS 7.7.05