Focal Point
[SOLVED] Label to rows (MERGE CELLS)

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

September 04, 2017, 03:22 PM
Amom
[SOLVED] Label to rows (MERGE CELLS)
Dear all,

I've the following report:
 
DEFINE FILE CAR 
DUMMY/A15='RECORDS';
END
TABLE FILE CAR
SUM
     CAR.BODY.SALES OVER
     CAR.BODY.SEATS OVER
     CAR.BODY.DEALER_COST 
BY DUMMY AS ''
ACROSS CAR.ORIGIN.COUNTRY AS ''
ON TABLE SET ASNAMES ON
-*ON TABLE HOLD
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
$
TYPE=REPORT,
     GRID=OFF,
$
ENDSTYLE
END
-RUN
 


But the dummy column needs to be vertically aligned, as the following output:

|--------------------------------------------------------------------------|
|		                ENGLAND	FRANCE	ITALY	JAPAN	W GERMANY  |
|--------------------------------------------------------------------------|
|        	 |SALES	        12000	0	30200	78030	88190      |
|RECORDS         |SEATS	        13	5	10	8	34         |
|	         |DEALER_COST	37,853	4,631	41,235	5,512	54,563     |
|--------------------------------------------------------------------------|



Is there some way to do this (with PDF and Excel also)?

Thanks in advance

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8
Windows, All Outputs
September 05, 2017, 04:16 AM
Tony A
Well, you can in HTML output by manipulating the tabular output that will be produced. It can get a little messy and you will generally be left with artefacts that you do not like, but FWIW .....

SET ACROSSLINE = OFF
DEFINE FILE CAR
   DUMMY/A1='';
   D_COUNTRY/A30 = IF COUNTRY EQ 'ENGLAND' THEN '</td><td>'||COUNTRY ELSE COUNTRY;
END
TABLE FILE CAR
SUM
     COMPUTE CNTR/I9 = LAST CNTR + 1; NOPRINT
     COMPUTE RECORDS/A100 = IF CNTR EQ 1 THEN '</td><td rowspan=3 style="vertical-align:middle;text-align:center;">Records' ELSE ''; AS '</td><td>'
BY DUMMY NOPRINT
SUM
     SALES OVER
	 SEATS OVER
	 DEALER_COST
BY DUMMY NOPRINT
ACROSS D_COUNTRY AS ''
ON TABLE SET PAGE NOLEAD
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
type=report, grid=off, $
ENDSTYLE
END
-RUN


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 
September 05, 2017, 08:45 AM
Amom
Hi Tony A,

It works very well to HTML.
But I will need to implement to pdf and excel also.


WebFOCUS 8
Windows, All Outputs
September 05, 2017, 09:16 AM
Tony A
quote:
you can in HTML output

Hence my reply.

Also, if your target is multiple output formats, it is often best to advise this within your first posting.

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 
September 05, 2017, 02:01 PM
Amom
Thanks Tony.

I just edited the first post.


WebFOCUS 8
Windows, All Outputs
September 06, 2017, 10:55 AM
jfr99
Hi,

Not sure if this will help in your situation, but it works for the CAR file example. (HTML, PDF OR XLSX)

Here's the code ...

-*
-** HOLD SALES DATA
-*
DEFINE FILE CAR
SRT/A1 = '1';
END
-*
TABLE FILE CAR
SUM COMPUTE VAL/A12 = FPRINT(SALES,'I6','A12');
BY SRT
BY COUNTRY
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS HLD_SAL
END
? HOLD HLD_SAL
-*
-** HOLD SEATS DATA
-*
DEFINE FILE CAR
SRT/A1 = '2';
END
-*
TABLE FILE CAR
SUM COMPUTE VAL/A12 = FPRINT(SEATS,'I3','A12');
BY SRT
BY COUNTRY
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS HLD_SEA
END
? HOLD HLD_SEA
-*
-** HOLD DEALER_COST DATA
-*
DEFINE FILE CAR
SRT/A1 = '3';
END
-*
TABLE FILE CAR
SUM COMPUTE VAL/A12 = FPRINT(DEALER_COST,'D7','A12');
BY SRT
BY COUNTRY
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS HLD_DEA
END
? HOLD HLD_DEA
-*
-** COMBINE ALL THREE HOLD FILES INTO ONE
-*
TABLE FILE HLD_SAL
PRINT SRT COUNTRY VAL
ON TABLE HOLD AS HLD_ALL
MORE
FILE HLD_SEA
MORE
FILE HLD_DEA
END
? HOLD HLD_ALL
-*
-** CREATE REPORT
-*
DEFINE FILE HLD_ALL
TMP01/A15 = DECODE SRT(
'1' ' ',
'2' 'RECORDS',
'3' ' ',
ELSE ' ');
TMP02/A15 = DECODE SRT(
'1' 'SALES',
'2' 'SEATS',
'3' 'DEALER_COST',
ELSE ' ');
END
-*
TABLE FILE HLD_ALL
SUM VAL
ACROSS COUNTRY AS ''
BY SRT NOPRINT
BY TMP01 AS ''
BY TMP02 AS ''
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, $
TYPE=ACROSSVALUE, ACROSS=1, JUSTIFY=RIGHT, $
TYPE=DATA, COLUMN=N4, JUSTIFY=RIGHT, $
TYPE=DATA, COLUMN=N5, JUSTIFY=RIGHT, $
TYPE=DATA, COLUMN=N6, JUSTIFY=RIGHT, $
TYPE=DATA, COLUMN=N7, JUSTIFY=RIGHT, $
TYPE=DATA, COLUMN=N8, JUSTIFY=RIGHT, $
ENDSTYLE
END
-RUN



WebFocus 8.201M, Windows, App Studio
September 06, 2017, 04:45 PM
Amom
Hi jfr99,

To HTML and PDF works well. Although this solution does not merge the cells, it helps to excel also.
Thanks a lot.


WebFOCUS 8
Windows, All Outputs
September 08, 2017, 09:09 AM
MartinY
FYI

To simplify styling alignment for the ACROSS column use :
TYPE=DATA, ACROSSCOLUMN=VAL, JUSTIFY=RIGHT, $

Instead of :
TYPE=ACROSSVALUE, ACROSS=1, JUSTIFY=RIGHT, $
TYPE=DATA, COLUMN=N4, JUSTIFY=RIGHT, $
TYPE=DATA, COLUMN=N5, JUSTIFY=RIGHT, $
TYPE=DATA, COLUMN=N6, JUSTIFY=RIGHT, $
TYPE=DATA, COLUMN=N7, JUSTIFY=RIGHT, $
TYPE=DATA, COLUMN=N8, JUSTIFY=RIGHT, $

That way, all ACROSS columns will be affected without the need of list them one by one. And it will take in consideration more than 5 columns.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007