[CLOSED] Grand total plus subtotals at the end of the report
Hi, i was wondering how you would go about having all the subfoots reprint at the end of the report followed by the grandtotal
Ex.
data data data data subfoot1 data data data data subfoot2 data data data data subfoot3 data data data data subfoot4
subfoot1 subfoot2 subfoot3 subfoot4 grandtotal
I hope this expains it! thanks so much for all the help!This message has been edited. Last edited by: Kerry,
WebFOCUS 7.6 Windows, All Outputs
June 29, 2011, 05:40 PM
Waz
I suspect that the Macgyver technique will help with this.
There are may examples in the forum, and on the tech support site.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
June 30, 2011, 10:34 AM
DavSmith
Waz is correct; McGyver is the ticket for, in your case, rediplay of subtotals at the end of the report. You'll find help in "Tips and Techniques" and here on Focal Point. To get you started, here's an example of the McGyver technique using the CAR database showing subtotals in the body and at the end of the report with a grand total using only pass of the data and no interim hold files.
-* Set up McGyver master and data file.
-*
-* Build McGyver MFD
FILEDEF MCMAS DISK MCGYV.MAS
-RUN
-WRITE MCMAS FILENAME=mcgyv, SUFFIX=FIX , $
-WRITE MCMAS SEGMENT=ONE, SEGTYPE=S0, $
-WRITE MCMAS FIELDNAME=CONTROL, USAGE=A1, ACTUAL=A1, $
-WRITE MCMAS SEGMENT=TWO, SEGTYPE=S0, PARENT=ONE, OCCURS=VARIABLE, $
-WRITE MCMAS FIELDNAME=CHAR1, USAGE=A1, ACTUAL=A1, $
-WRITE MCMAS FIELDNAME=CTR, ALIAS=ORDER, USAGE=I4, ACTUAL=I4, $
-*
-* Build McGyver FTM
FILEDEF MCGYV DISK MCGYV.FTM
-RUN
-* Control=X: used as Join cross reference target field
-* CHAR1=A, CTR=1: display detail
-* CHAR1=B, CTR=2: display dynamic subtotals/subfoots
-WRITE MCGYV XAB
-**************************************************************************************
-RUN
JOIN CONTROL WITH BODYTYPE IN CAR TO UNIQUE CONTROL IN MCGYV AS J2
-* CTR=1 display detail, CTR=2 display subtotals/subfoots.
DEFINE FILE CAR
CONTROL /A1 WITH BODYTYPE='X';
SUM_COUNTRY /A10=IF CTR EQ 1 THEN COUNTRY ELSE ' ';
SUM_CAR /A18 =IF CTR EQ 2 THEN COUNTRY
ELSE CAR;
SF_SALES /P12.2CM=SALES;
END
-*******
SET DROPBLNKLINE=ON
TABLE FILE CAR
SUM SALES/P12.2CM
BY CTR NOPRINT
BY SUM_COUNTRY AS COUNTRY SUBTOTAL MULTILINES AS '*Sub-Total:'
WHEN CTR EQ 1
BY SUM_CAR AS CAR
ON CTR SUBFOOT
"*Grand Total: <ST.SF_SALES"
WHEN CTR EQ 2
ON SUM_COUNTRY AS COUNTRY SUBHEAD
"</1 *Country Sub-Total Round-Up:"
WHEN CTR EQ 2
ON TABLE NOTOTAL
ON TABLE SET PAGE NOLEAD
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET STYLE *
FONT='ARIAL', SIZE=10,GRID=OFF,$
TYPE=SUBHEAD, STYLE=BOLD,$
TYPE=SUBTOTAL,STYLE=BOLD,$
TYPE=SUBFOOT, HEADALIGN=BODY,STYLE=BOLD,$
TYPE=SUBFOOT, ITEM=1,COLSPAN=2,$
TYPE=SUBFOOT, ITEM=2,JUSTIFY=RIGHT,$
ENDSTYLE
END
In FOCUS since 1985 - WF 8.009/8.104 Win 8 Outputs: ALL of 'em! Adapters: Sql Server Teradata Oracle