Forums
FOCUS/WebFOCUS
[Solved] Trying to have totals (subtotals?) above detail lines in report|
Go
![]() |
New
![]() |
Search
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Platinum Member |
In Mainframe FOCUS, I am developing a report where I wish to have one or two lines of record information, including totals for some fileds, and then I want to have detail lines print below this total line.
How might I get totals or subtotals into the subhead line and then print the detail lines below this line? Thank you in advance, and looking forward to any and all replies. This message has been edited. Last edited by: webmeister, Mainframe FOCUS 7.0 VM/CMS and MVS/TSO |
||
|
|
Virtuoso |
Create two hold files, one with the details and one with the subtotals.
Add an extra by field in both hold files. Say 'A' for the subtotals and 'B' for the details. Combine the two hold files to one and create a report on the combined hold file with the extra field as first (invisible) sort field . Based on that same field you can get the subtotals bold or cursive.
|
|||||||
|
|
Platinum Member |
try this example:
SET ASNAMES=ON
TABLE FILE CAR
SUM FUEL_CAP AS 'TOTAL_FUEL_CAP'
BY COUNTRY
ON TABLE HOLD AS HOLD1
END
TABLE FILE CAR
PRINT FUEL_CAP AS 'DETAIL_FUEL_CAP'
BY COUNTRY
BY CAR
BY MODEL
ON TABLE HOLD AS HOLD2
END
MATCH FILE HOLD1
PRINT TOTAL_FUEL_CAP
BY COUNTRY
RUN
FILE HOLD2
PRINT DETAIL_FUEL_CAP
BY COUNTRY
BY CAR
BY MODEL
AFTER MATCH HOLD OLD-OR-NEW
END
TABLE FILE HOLD
PRINT
DETAIL_FUEL_CAP
BY COUNTRY
BY CAR
BY MODEL
ON COUNTRY SUBHEAD
" Total Fuel Cap for <COUNTRY is <TOTAL_FUEL_CAP "
ON COUNTRY SKIP-LINE
END
prod:7.1.2/win2k3/ss/rpt caster/dev studio 7.6.4 win xp |
|||
|
|
Virtuoso |
You can use prefix operators with fields in subheads so somthing like the following should get what you want.
TABLE FILE CAR
SUM CAR RCOST DCOST
BY COUNTRY
BY CAR
ON COUNTRY SUBHEAD
"Total for Country <COUNTRY <ST.RCOST <ST.DCOST"
ON COUNTRY SUBFOOT
" "
ON TABLE SET ONLINE-FMT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=10,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
$
TYPE=SUBHEAD, COLOR='RED',$
TYPE=SUBHEAD, BY=1, LINE=1, ITEM=4,POSITION=RCOST,$
TYPE=SUBHEAD, BY=1, LINE=1, ITEM=6,POSITION=DCOST,$
$
ENDSTYLE
END
Regards, Darin WF Server: 7.1.6 on Z/OS and Linux, ReportCaster, Self-Service, MRE, Java Data: DB2, DB2/UDB, Adabas, SQL Server Output: HTML,PDF,Excel2K WF Client: Linux w/WebSphere, Servlet, CGI |
|||
|
|
Virtuoso |
On second thought, that won't get correct totals. Try this instead:
DEFINE FILE CAR
RCOST1/D9C=RCOST;
DCOST1/D9C=DCOST;
END
TABLE FILE CAR
SUM RCOST1 WITHIN COUNTRY NOPRINT
DCOST1 WITHIN COUNTRY NOPRINT
CAR RCOST DCOST
BY COUNTRY
BY CAR NOPRINT
ON COUNTRY SUBHEAD
"Total for Country <COUNTRY <ST.RCOST1 <ST.DCOST1"
ON COUNTRY SUBFOOT
" "
ON TABLE SET ONLINE-FMT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=10,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
$
TYPE=SUBHEAD, COLOR='RED',$
TYPE=SUBHEAD, BY=1, LINE=1, ITEM=4,POSITION=RCOST,$
TYPE=SUBHEAD, BY=1, LINE=1, ITEM=6,POSITION=DCOST,$
$
ENDSTYLE
END
Regards, Darin WF Server: 7.1.6 on Z/OS and Linux, ReportCaster, Self-Service, MRE, Java Data: DB2, DB2/UDB, Adabas, SQL Server Output: HTML,PDF,Excel2K WF Client: Linux w/WebSphere, Servlet, CGI |
|||
|
|
Virtuoso |
Darin,
I tried that and it doesn't work. ST. only picks up the first entry for the sort field. WM could do what the other posts said or maybe try a multi-verb request. Ginny --------------------------------- Prod: WF 7.6.5 with 7.6.6 WFRS; AIX 5.2; WebSphere 6.1.0.15 Dev: WF 7.6.5 with 7.6.6 WFRS; AIX 5.3; WebSphere 6.1.0.15 Primarily self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable |
|||
|
|
Virtuoso |
Yup - caught that. See my last post
Regards, Darin WF Server: 7.1.6 on Z/OS and Linux, ReportCaster, Self-Service, MRE, Java Data: DB2, DB2/UDB, Adabas, SQL Server Output: HTML,PDF,Excel2K WF Client: Linux w/WebSphere, Servlet, CGI |
|||
|
|
Platinum Member |
darin - that works. nice.
prod:7.1.2/win2k3/ss/rpt caster/dev studio 7.6.4 win xp |
|||
|
|
Platinum Member |
To all of you for responding and suggesting so quickly, a big thank you! I'll put those suggestions into my project...and it should work. I had my head wrapped too tightly into the project and could not see the forest for the trees.
Again, thank you! Mainframe FOCUS 7.0 VM/CMS and MVS/TSO |
|||
|
|
Master |
Remember that SUBHEAD always takes the values of inserted data from the first line of the sortgroup. So one can do away with DEFINEs and use a plain multi-set request:
TABLE FILE CAR SUM RCOST NOPRINT DCOST NOPRINT BY COUNTRY PRINT RCOST DCOST BY COUNTRY ON COUNTRY SUBHEAD "<COUNTRY<RCOST<DCOST" ON COUNTRY SUBFOOT " " ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * TYPE=SUBHEAD, HEADALIGN=BODY, $ TYPE=SUBHEAD, ITEM=2, JUSTIFY=RIGHT, $ TYPE=SUBHEAD, ITEM=3, JUSTIFY=RIGHT, $ ENDSTYLE END |
|||
|
|
Master |
And something more. In 7.6.7 there is a new SET command:
SET DUPLICATECOL={ON | OFF}
And the example in the documentation (page 43, 767snf.pdf):
Displaying Reports With Multiple Display Commands
The following request sums current salaries and education hours for the entire EMPLOYEE
data source and for each department:
TABLE FILE EMPLOYEE
SUM CURR_SAL ED_HRS
SUM CURR_SAL ED_HRS BY DEPARTMENT
END
With DUPLICATECOL=ON, the output has separate columns for the grand totals and for the
departmental totals:
CURR_SAL ED_HRS DEPARTMENT CURR_SAL ED_HRS
-------- ------ ---------- -------- ------
$222,284.00 351.00 MIS $108,002.00 231.00
PRODUCTION $114,282.00 120.00
With DUPLICATECOL=OFF, the output has one column for each field. The grand totals are
on the top row of the report, and the departmental totals are on additional rows below the
grand totals:
DEPARTMENT CURR_SAL ED_HRS
---------- -------- ------
$222,284.00 351.00
MIS $108,002.00 231.00
PRODUCTION $114,282.00 120.00
|
|||
|
|
Virtuoso |
A nice found Danny, in fact the SET DUPLICATION add something you can compare with a multiverb report.
|
|||||||
|
|
Master |
Yes, and there is a styling attribute called VERBSET to style each set of a multi-set request differently.
See: http://documentation.informationbuilders.com/masterinde...f/source/topic43.htm |
|||
|
|
Platinum Member |
Danny,
Thanks for replying, however.... we are an archaic FOCUS site, running FOCUS 7.1, and the DUPLICATECOL will not therefore help. If you have another idea or two, I would love to hear them, but it would have to be for an older release of mainframe FOCUS. Thanks again, Mainframe FOCUS 7.0 VM/CMS and MVS/TSO |
|||
|
|
Virtuoso |
Maybe working out my suggestion will help you a bit.
SET ASNAMES=ON DEFINE FILE CAR GROUPCODE/A1='A'; DCAR/A10=''; DMODEL/A10=''; END TABLE FILE CAR SUM FUEL_CAP BY GTOUPCODE BY COUNTRY BY DCAR AS CAR BY DMODEL AS MODEL ON TABLE HOLD AS HOLD1 END DEFINE FILE CAR GROUPCODE/A1='B'; END TABLE FILE CAR PRINT FUEL_CAP BY GROUPCODE BY COUNTRY BY CAR BY MODEL ON TABLE HOLD AS HOLD2 END -RUN TABLE FILE HOLD1 PRINT * ON TABLE HOLD AS HOLD3 MORE FILE HOLD2 END -RUN TABLE FILE HOLD3 PRINT FUEL_CAP BY GROUPCODE NOPRINT BY COUNTRY BY CAR BY MODEL END This will give you the totals on the first line and then the details . If you want a subtotal too, you can create a 3th HOLD file for that.
|
|||||||
|
|
Platinum Member |
Thanks, Frank,
I'll play around with that and incorporate it into what someof the other folks have suggested. Thank you to all who responded and offered your help! Mainframe FOCUS 7.0 VM/CMS and MVS/TSO |
|||
|
|
Master |
Try this:
DEFINE FILE CAR TTL_CST/D12.2=DEALER_COST; TTL_SLS/D12.2=SALES; END TABLE FILE CAR SUM TTL_CST NOPRINT TTL_SLS NOPRINT BY COUNTRY PRINT DEALER_COST SALES BY COUNTRY BY CAR ON COUNTRY SUBHEAD "TOTAL <TTL_CST <TTL_SLS" END Pat WF 5.3.2 AIX, NT, AS/400, Focus AS/400, AIX, Oracle, JDE, DB2, Lotus Notes |
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|
Forums
FOCUS/WebFOCUS
[Solved] Trying to have totals (subtotals?) above detail lines in report
