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.
H folks, I am looking for a solution to handle a SUBFOOT with an ACROSS. I read some topics but I couldn´t find a solution yet.
Can anyone give me a hint?
Thanks
My report is:
TABLE FILE HX2
SUM
VENTAS AS 'Ventas'
VENTAS_IND_SEG NOPRINT
VENTAS_IND_SUBSEG NOPRINT
COMPUTE PCT_VENTAS/D8.1 = (C1/C3)*100;
COMPUTE PCT_TOT_VENTAS/D8.1 = (C1/C2)*100;
ACROSS MONTH NOPRINT
ACROSS MONTH_REPORT AS ''
BY SUBSEG AS ''
ON MONTH SUBFOOT
"<PCT_TOT_VENTAS"
END
I reproduced it using CAR here:
SET ASNAMES=ON
TABLE FILE CAR
SUM SALES AS 'SALES_BODY'
BY BODYTYPE
SUM SALES AS 'SALES_MODEL'
BY BODYTYPE
BY MODEL
SUM SALES
BY BODYTYPE
BY MODEL
BY COUNTRY
ON TABLE HOLD AS H1
END
TABLE FILE H1
SUM
SALES
SALES_BODY NOPRINT
SALES_MODEL NOPRINT
COMPUTE PCT_A/D8.1 = (C1/C3)*100;
COMPUTE PCT_TOT/D8.1 = (C1/C2)*100; NOPRINT
ACROSS COUNTRY
-* I need it summarized, without this BY COUNTRY
BY COUNTRY NOPRINT
ON COUNTRY RECAP
TOT/I9 = C1;
ON COUNTRY SUBFOOT
"TOTAL: <TOT<PCT_TOT"
ON TABLE SET STYLE *
TYPE=TABFOOTING, HEADALIGN=BODY, $
TYPE=SUBFOOT, HEADALIGN=BODY, $
TYPE=SUBFOOT,
BY=COUNTRY,
SIZE=9,
OBJECT=FIELD,
JUSTIFY=RIGHT, $
END
This message has been edited. Last edited by: Ricardo Augusto,
WebFOCUS 8.1.05 / APP Studio
Posts: 272 | Location: Brazil | Registered: October 31, 2006
Can you please try the below solution? It may be helpful for you.
SET ASNAMES=ON
TABLE FILE CAR
SUM SALES AS 'SALES_BODY'
BY BODYTYPE
SUM SALES AS 'SALES_MODEL'
BY BODYTYPE
BY MODEL
SUM SALES
BY BODYTYPE
BY MODEL
BY COUNTRY
ON TABLE HOLD AS H1
END
DEFINE FILE H1
FLG/A1='A';
END
TABLE FILE H1
SUM SALES NOPRINT SALES_BODY NOPRINT SALES_MODEL NOPRINT
SUM
SALES
SALES_BODY
SALES_MODEL NOPRINT
COMPUTE PCT_A/D8.1 = (SALES/SALES_MODEL)*100;
COMPUTE PCT_TOT/D8.1 = (SALES/SALES_BODY)*100;
ACROSS COUNTRY
-* I need it summarized, without this BY COUNTRY
BY FLG NOPRINT
ON FLG RECAP
TOT/I9 = SALES;
PCT_TOT1/D8.1 = (C1/C2)*100;
ON FLG SUBFOOT
"TOTAL: <SALES<PCT_TOT1"
ON TABLE SET STYLE *
TYPE=TABFOOTING, HEADALIGN=BODY, $
TYPE=SUBFOOT, HEADALIGN=BODY, $
TYPE=SUBFOOT,
BY=COUNTRY,
SIZE=9,
OBJECT=FIELD,
JUSTIFY=RIGHT, $
END
You mean to say, you need PC_TOT in subfoot for each country? If so Subfoot will not be the right solution. Better you can go with Appending.This message has been edited. Last edited by: narumu,
Is there any other way to show values at their right place?
SET ASNAMES=ON
TABLE FILE CAR
SUM SALES AS 'SALES_BODY'
BY BODYTYPE
SUM SALES AS 'SALES_MODEL'
BY BODYTYPE
BY MODEL
SUM SALES
BY BODYTYPE
BY MODEL
BY COUNTRY
ON TABLE HOLD AS H1
END
TABLE FILE H1
SUM
SALES
SALES_BODY NOPRINT
SALES_MODEL NOPRINT
COMPUTE PCT_A/D8.1 = (C1/C3)*100;
COMPUTE PCT_TOT/D8.1 = (C1/C2)*100; NOPRINT
ACROSS COUNTRY
-* I need it summarized, without this BY COUNTRY
BY COUNTRY NOPRINT
ON COUNTRY RECAP
TOT/I9 = C1;
ON COUNTRY SUBFOOT
"TOTAL: <TOT<PCT_TOT"
ON TABLE SET STYLE *
TYPE=TABFOOTING, HEADALIGN=BODY, $
TYPE=SUBFOOT, HEADALIGN=BODY, $
TYPE=SUBFOOT,
BY=COUNTRY,
SIZE=9,
OBJECT=FIELD,
JUSTIFY=RIGHT, $
END
WebFOCUS 8.1.05 / APP Studio
Posts: 272 | Location: Brazil | Registered: October 31, 2006
I am little bit confused with your requirement.If you not having any problem can you please explain it in detail? So that i can explore in some other way.
Ricardo, I didn't quite get what you are aming at. Nonetheless, if you want subtotals with across, this should do the trick.
-* File ricardo02.fex
SET ASNAMES=ON
-*
DEFINE FILE CAR
BODYTYPE=IF MPG LT 10 THEN 'SEDAN' ELSE
IF MPG LT 15 THEN 'HARDTOP' ELSE
IF MPG LT 20 THEN 'COUPE' ELSE 'ROADSTER';
END
-*
TABLE FILE CAR
SUM RCOST AS 'RCOST_BODY'
BY BODYTYPE
SUM RCOST AS RCOST
BY BODYTYPE
BY COUNTRY
ON TABLE HOLD AS H1
END
-RUN
DEFINE FILE H1
SP/A1=' ';
END
-*
TABLE FILE H1
SUM
RCOST
RCOST_BODY
COMPUTE PCT_TOT/D8.1 = (C1/C2)*100;
ACROSS COUNTRY
BY SP NOPRINT
BY BODYTYPE
ON SP RECOMPUTE
ON TABLE NOTOTAL
ON TABLE SET STYLE *
INCLUDE=ENDEFLT,
$
ENDSTYLE
END
I changed the values of BODYTYPE in order to populate the output a bit better. However, if SUBFOOT is a necessity, give an example of what you want to achieve.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
TABLE FILE CAR SUM SALES AS 'SALES_BODY' BY BODYTYPE SUM SALES AS 'SALES_MODEL' BY BODYTYPE BY MODEL SUM SALES BY BODYTYPE BY MODEL BY COUNTRY ON TABLE HOLD AS H1 END
TABLE FILE H1 SUM SALES SALES_BODY NOPRINT SALES_MODEL NOPRINT COMPUTE PCT_A/D8.1 = (C1/C3)*100; COMPUTE PCT_TOT/D8.1 = (C1/C2)*100; NOPRINT ACROSS COUNTRY -* I need it summarized, without this BY COUNTRY BY COUNTRY NOPRINT ON COUNTRY RECAP TOT/I9 = C1; ON COUNTRY SUBFOOT "TOTAL: ON TABLE SET STYLE * TYPE=TABFOOTING, HEADALIGN=BODY, $ TYPE=SUBFOOT, HEADALIGN=BODY, $ TYPE=SUBFOOT, BY=COUNTRY, SIZE=9, OBJECT=FIELD, JUSTIFY=RIGHT, $ END
If you run this code you will see what I want. I just want this but I need it summarized by country. For each country I have a specific total to show as a SUBFOOT. How I do that?
WebFOCUS 8.1.05 / APP Studio
Posts: 272 | Location: Brazil | Registered: October 31, 2006
What I can suggest you, which is more work I admit but it works, built the report structure yourself.
You will need several steps:
1- extract and hold the detailed lines of your report and add a RowId to them, such as RowId = 100 2- extract and hold the subtotal rows for your report and add RowId to them, such as RowId = 200 3- merge both files together. Both files will need to have the exact same format and because the subtotal file will not have the exact same "keys" as the detailed one, you will have to assigned default values in the subtotal file. 4- other and print merged data in the proper order.
Here a sample. You will then have to play with the formatting as you need:
SET ASNAMES=ON
-* HOLD DETAILED ROWS
TABLE FILE CAR
SUM RETAIL_COST AS 'RETAIL'
BY BODYTYPE
BY COUNTRY
BY MODEL
BY TOTAL COMPUTE ROWID /P3 = 100;
BY TOTAL COMPUTE ROWTYP /P3 = 100;
ON TABLE HOLD AS DETDATA
END
-RUN
-* HOLD SUBTOTAL COUNTRY
TABLE FILE CAR
SUM RETAIL_COST AS 'RETAIL'
BY BODYTYPE
BY COUNTRY
BY TOTAL COMPUTE MODEL /A24 = 'Total Country';
BY TOTAL COMPUTE ROWID /P3 = 100;
BY TOTAL COMPUTE ROWTYP /P3 = 200;
ON TABLE HOLD AS CNTRYTOT
END
-RUN
-* HOLD SUBTOTAL BODYTYPE
TABLE FILE CAR
SUM RETAIL_COST AS 'RETAIL'
BY BODYTYPE
BY TOTAL COMPUTE COUNTRY /A10 = '';
BY TOTAL COMPUTE MODEL /A24 = 'Total Bodytype';
BY TOTAL COMPUTE ROWID /P3 = 300;
BY TOTAL COMPUTE ROWTYP /P3 = 200;
ON TABLE HOLD AS BODYTOT
END
-RUN
-* MERGE FILES
TABLE FILE DETDATA
SUM RETAIL
BY BODYTYPE
BY ROWID NOPRINT
BY COUNTRY
BY ROWTYP NOPRINT
BY MODEL
MORE
FILE CNTRYTOT
MORE
FILE BODYTOT
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
Everything is possible. With my technique you build your data as you which then you display the way you want.
The ACROSS is just a way to display the data. The thing is to not process any TOTAL because you already have built it yourself.
SET ASNAMES=ON
-* HOLD DETAILED ROWS
TABLE FILE CAR
SUM RETAIL_COST AS 'RETAIL_CST'
DEALER_COST AS 'DEALER_CST'
COMPUTE PCT /P5.2C% = (RETAIL_COST - DEALER_COST) / DEALER_COST * 100;
BY BODYTYPE
BY COUNTRY
BY MODEL
BY TOTAL COMPUTE ROWID /P3 = 100;
BY TOTAL COMPUTE ROWTYP /P3 = 100;
ON TABLE HOLD AS DETDATA
END
-RUN
-* HOLD SUBTOTAL BODYTYPE
TABLE FILE CAR
SUM RETAIL_COST AS 'RETAIL_CST'
DEALER_COST AS 'DEALER_CST'
COMPUTE PCT /P5.2C% = (RETAIL_COST - DEALER_COST) / DEALER_COST * 100;
BY BODYTYPE
BY COUNTRY
BY TOTAL COMPUTE MODEL /A24 = 'Total Bodytype';
BY TOTAL COMPUTE ROWID /P3 = 100;
BY TOTAL COMPUTE ROWTYP /P3 = 200;
ON TABLE HOLD AS BODYTOT
END
-RUN
-*
-* HOLD SUBTOTAL COUNTRY
TABLE FILE CAR
SUM RETAIL_COST AS 'RETAIL_CST'
DEALER_COST AS 'DEALER_CST'
COMPUTE PCT /P5.2C% = (RETAIL_COST - DEALER_COST) / DEALER_COST * 100;
BY TOTAL COMPUTE BODYTYPE/A12 = '';
BY COUNTRY
BY TOTAL COMPUTE MODEL /A24 = 'Total Country';
BY TOTAL COMPUTE ROWID /P3 = 300;
BY TOTAL COMPUTE ROWTYP /P3 = 200;
ON TABLE HOLD AS CNTRYTOT
END
-RUN
-* MERGE FILES
TABLE FILE DETDATA
SUM RETAIL_CST
DEALER_CST
PCT
BY ROWID NOPRINT
BY BODYTYPE
BY ROWTYP NOPRINT
BY MODEL
ACROSS COUNTRY
MORE
FILE BODYTOT
MORE
FILE CNTRYTOT
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
-* File ricardo03.fex
SET ASNAMES=ON
-*
DEFINE FILE CAR
BODYTYPE=IF MPG LT 10 THEN 'SEDAN' ELSE
IF MPG LT 15 THEN 'HARDTOP' ELSE
IF MPG LT 20 THEN 'COUPE' ELSE 'ROADSTER';
END
-*
TABLE FILE CAR
SUM RCOST AS 'RCOST_BODY'
BY BODYTYPE
SUM RCOST AS RCOST
BY BODYTYPE
BY COUNTRY
ON TABLE HOLD AS H1
END
-RUN
-*
TABLE FILE H1
BY COUNTRY
ON TABLE SAVE
END
-RUN
-SET &C=&LINES;
-RUN
TABLE FILE H1
SUM
RCOST
RCOST_BODY
COMPUTE PCT_TOT/D8.1 = (C1/C2)*100;
BY COUNTRY NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD FORMAT ALPHA
END
-RUN
-SET &SUBTOT='"Totals';
TABLE FILE H1
SUM
RCOST
RCOST_BODY
COMPUTE PCT_TOT/D8.1 = (C1/C2)*100;
ACROSS COUNTRY
BY BODYTYPE
ON TABLE SUBFOOT
-REPEAT #TOTS FOR &I FROM 1 TO &C;
-READFILE HOLD
-SET &RCOST=FPRINT(&RCOST,'D7','A9');
-SET &RCOST_BODY=FPRINT(&RCOST_BODY,'D7','A9');
-SET &PCT_TOT=FPRINT(&PCT_TOT,'D8.1','A9');
-SET &SUBTOT=&SUBTOT || ' <0 <0 ' | &RCOST | '<0 ' | &RCOST_BODY | '<0 ' | &PCT_TOT ;
-#TOTS
-SET &SUBTOT=&SUBTOT || '"';
&SUBTOT
ON TABLE NOTOTAL
ON TABLE SET STYLE *
INCLUDE=ENDEFLT,
$
TYPE=TABFOOTING, HEADALIGN=BODY, SIZE=10, JUSTIFY=RIGHT, $
TYPE=TABFOOTING, ITEM=1, size=10, JUSTIFY=LEFT, $
ENDSTYLE
END
This message has been edited. Last edited by: Danny-SRL,
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
that loop to add values on subfoot using dm looks awesome but I couldn´t implement it on my code. Thanks anyway.
MartinY,
I followed your 4 steps then I am now able to have it working, but now I need to change few columns order.
Final code is:
TABLE FILE HDETAILS
SUM VENTAS_SUBSEG_FORD AS 'Vol'
PCT AS '%'
ACU NOPRINT
PCT_ACU NOPRINT
X NOPRINT
Z NOPRINT
BY SUBSEG AS ''
ACROSS SRSD83_PERIOD_R AS ''
COMPUTE A/D8=ACU; AS '&YEAR Acu'
COMPUTE B/D8.1 = PCT_ACU; AS '&YEAR %
COMPUTE C/D8 = X; AS '&LAST_YEAR Acu'
COMPUTE D/D8.1 = Z; AS '&LAST_YEAR %'
MORE
FILE HTOTALS
END
I need to have it like:
TABLE FILE HDETAILS
ON TABLE HOLD AS H023REPORT
SUM VENTAS_SUBSEG_FORD
PCT
ACU NOPRINT
PCT_ACU NOPRINT
X NOPRINT
Z NOPRINT
&BY
BY SRSD83_PERIOD_R
COMPUTE A/D8=ACU;
COMPUTE B/D8.1 = PCT_ACU;
COMPUTE C/D8 = X;
COMPUTE D/D8.1 = Z;
MORE
FILE HTOTALS
END
TABLE FILE H023REPORT
SUM VENTAS_SUBSEG_FORD AS 'Vol'
PCT AS '%'
ACU NOPRINT
PCT_ACU NOPRINT
X NOPRINT
Z NOPRINT
&BY AS ''
ACROSS SRSD83_PERIOD_R AS ''
COMPUTE A/D8=ACU; AS '&YEAR Acu'
COMPUTE B/D8.1 = PCT_ACU; AS '&YEAR %'
COMPUTE C/D8 = X; AS '&LAST_YEAR Acu'
COMPUTE D/D8.1 = Z; AS '&LAST_YEAR %'
HEADING CENTER
"&TITLE"
ON TABLE SET STYLE *
TYPE=REPORT, COLUMN=C, SEQUENCE=2,$
TYPE=REPORT, COLUMN=D, SEQUENCE=3,$
END
-EXIT
END
This is working but it places Vol and % at wrong places. Any suggestion?This message has been edited. Last edited by: Ricardo Augusto,
WebFOCUS 8.1.05 / APP Studio
Posts: 272 | Location: Brazil | Registered: October 31, 2006
Things that I don't understand is why you are holding in H023REPORT when what you are doing with that file can be done at the previous step ?
Also why would you like to have something different when your "Final code" does it the way you want ? Especially when your "I need to have it like" doesn't seems to do nothing more.
When a COMPUTE is done, except if the BY fields change between steps you don't need to do twice the exact same thing : BY becomes a ACROSS which is the "same" thing except for the display option. It's your only difference (except for AS that have been added also for display purposes).
Difficult to figure what is your need. It's not possible to reproduce with your files: try to reproduce with sample CAR file (or other IBI sample files) or post image of what you have already (Final code) and what you need (I need to have it).
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