As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I want to put subtotal and count of the number of lines in either a subheading or a subtotal line. So for the car example below I would like to have in either the subhead or subtotal for England
Lines: 2 Subtotal: 45,319
TABLE FILE CAR
SUM
CAR.BODY.RETAIL_COST
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
ON CAR.ORIGIN.COUNTRY SUBHEAD
" "
ON CAR.ORIGIN.COUNTRY SUBTOTAL AS 'Subtotal '
END
This message has been edited. Last edited by: Trudy,
TABLE FILE CAR
SUM COMPUTE NB_ROW /I3 = 1;
CAR.BODY.RETAIL_COST
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
ON CAR.ORIGIN.COUNTRY SUBHEAD
" "
ON CAR.ORIGIN.COUNTRY SUBTOTAL AS 'Subtotal '
END
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
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
SET ASNAMES = ON
TABLE FILE CAR
SUM CNT.CAR AS 'Nb Row'
BY COUNTRY
SUM RETAIL_COST AS 'Retail Cost'
BY COUNTRY AS 'Country'
BY CAR AS 'Car'
END
-RUN
Or that:
TABLE FILE CAR
SUM RETAIL_COST
COMPUTE NB_ROW /I3 = 1;
BY COUNTRY
BY TOTAL COMPUTE ROWID /I1 = IF COUNTRY EQ LAST COUNTRY THEN ROWID ELSE ROWID + 1;
BY TOTAL COMPUTE TOTROW /I1 = 0;
BY CAR
ON TABLE HOLD AS EXTDATA FORMAT FOCUS
END
-RUN
DEFINE FILE EXTDATA
ROWID /I1 = IF COUNTRY EQ LAST COUNTRY THEN LAST ROWID ELSE ROWID;
END
TABLE FILE EXTDATA
SUM RETAIL_COST
NB_ROW
BY COUNTRY
BY ROWID
BY TOTAL COMPUTE TOTROW /I1 = 1;
BY TOTAL COMPUTE CAR /A16 = '';
ON TABLE HOLD AS TOTDATA FORMAT FOCUS
END
-RUN
TABLE FILE EXTDATA
SUM RETAIL_COST
NB_ROW
BY COUNTRY
BY TOTROW
BY ROWID
BY CAR
ON TABLE HOLD AS MRGDATA FORMAT FOCUS
MORE
FILE TOTDATA
END
-RUN
DEFINE FILE MRGDATA
NB_ROWX /I3 MISSING ON = IF TOTROW EQ 0 THEN MISSING ELSE NB_ROW;
COUNTRYX /A20 = IF TOTROW EQ 0 THEN COUNTRY ELSE 'Subtotal ' | COUNTRY;
END
TABLE FILE MRGDATA
SUM RETAIL_COST AS 'Retail Cost'
NB_ROWX AS 'Nb Row'
BY ROWID NOPRINT
BY TOTROW NOPRINT
BY COUNTRYX AS 'Country'
BY CAR AS 'Car'
ON ROWID SUBHEAD
""
ON TABLE SET PAGE-NUM NOLEAD
END
-RUN
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
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
TABLE FILE CAR
SUM
CNT.CAR AS 'NB_ROW'
RETAIL_COST AS 'RT_SUBTOT'
BY COUNTRY
SUM
RETAIL_COST
BY COUNTRY
BY CAR
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS HOLD_CAR
END
TABLE FILE HOLD_CAR
SUM
RETAIL_COST
BY COUNTRY
BY CAR
ON COUNTRY SUBHEAD
"Lines: <NB_ROW Subtotal <COUNTRY : <RT_SUBTOT"
""
END
Here is another way to add subtotals in a subfoot :
TABLE FILE CAR
SUM COMPUTE NB_ROW /I3 = 1; NOPRINT
CAR.BODY.RETAIL_COST
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
ON CAR.ORIGIN.COUNTRY SUBHEAD
" "
ON COUNTRY SUBFOOT
"Number of Lines: <ST.NB_ROW"
"Cost : <ST.RETAIL_COST"
END
Webfocus v8.2.02 OS:Windows 10, DB2, SQL Output: HTML, PDF and Excel
Originally posted by RayP: Here is another way to add subtotals in a subfoot :
TABLE FILE CAR
SUM COMPUTE NB_ROW /I3 = 1; NOPRINT
CAR.BODY.RETAIL_COST
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
ON CAR.ORIGIN.COUNTRY SUBHEAD
" "
ON COUNTRY SUBFOOT
"Number of Lines: <ST.NB_ROW"
"Cost : <ST.RETAIL_COST"
END
Nice clean approach.
I've tried to use it with one of my reports, but I'm not getting the total rows. The number for the total rows on the SUBHEAD (I am using a SUBHEAD instead of a SUBFOOT) is showing 1 all the time.
Originally posted by RayP: Here is another way to add subtotals in a subfoot :
TABLE FILE CAR
SUM COMPUTE NB_ROW /I3 = 1; NOPRINT
CAR.BODY.RETAIL_COST
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
ON CAR.ORIGIN.COUNTRY SUBHEAD
" "
ON COUNTRY SUBFOOT
"Number of Lines: <ST.NB_ROW"
"Cost : <ST.RETAIL_COST"
END
Nice clean approach.
I've tried to use it with one of my reports, but I'm not getting the total rows. The number for the total rows on the SUBHEAD (I am using a SUBHEAD instead of a SUBFOOT) is showing 1 all the time.
Um... ok... I think I figured it out... sorta... ST stands for SubTotal and seems like it can only be used in the SUBFOOT. Is there something equivalent to ST for the SUBHEAD?
TABLE FILE CAR
SUM COMPUTE NB_ROW /I3 = 1;
RETAIL_COST
BY COUNTRY
BY TOTAL COMPUTE ROWID /I2 = 2;
BY CAR
ON TABLE HOLD AS EXTDATA
END
-RUN
TABLE FILE EXTDATA
SUM NB_ROW
RETAIL_COST
BY COUNTRY
BY TOTAL COMPUTE ROWID /I2 = 1;
BY TOTAL COMPUTE CAR /A16 = 'Total';
ON TABLE HOLD AS TOTDATA
END
-RUN
TABLE FILE EXTDATA
SUM NB_ROW
RETAIL_COST
BY COUNTRY
BY ROWID
BY CAR
ON TABLE HOLD AS RPTDATA
MORE
FILE TOTDATA
END
-RUN
TABLE FILE RPTDATA
SUM NB_ROW AS 'Nb Rows'
RETAIL_COST AS 'Retail Cost'
BY COUNTRY AS 'Country'
BY ROWID NOPRINT
BY CAR AS 'Car'
ON ROWID SUBFOOT
""
ON TABLE NOTOTAL
END
-RUN
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
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
So for SUBHEAD to pick up total values, use a multiset request.
TABLE FILE CAR
"Retail Cost Report"
-* Totals within Country.
SUM
COMPUTE CARCOST/D12C = SUM.RCOST; NOPRINT
COMPUTE CARCNT/I9 = CNT.CAR; NOPRINT
BY COUNTRY NOPRINT
-* Total within Country/Car.
SUM RCOST AS 'Retail Cost'
BY COUNTRY NOPRINT
ON COUNTRY SUBHEAD
"Country: <COUNTRY"
"Number of Cars: <CARCNT"
"Total Retail Cost: <CARCOST"
BY CAR AS 'Car'
ON TABLE SET STYLE *
INCLUDE=ENSilver_DarkComp.sty, $
TYPE=HEADING, JUSTIFY=CENTER,$
TYPE=TITLE, JUSTIFY=CENTER,$
TYPE=SUBHEAD, SIZE=9,$
ENDSTYLE
END
This message has been edited. Last edited by: David Briars,
Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster