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.
Vinod, are you doing an ACROSS or a straight PRINT? If the latter, you can do several computes, one for the yeses, one for all, and one to calculate the percent. You would noprint the first two.
If you have an across for the columns then you need to put in some looping
TABLE FILE CAR SUM COMPUTE PROW/I5= LAST PROW +1; -* -* THIS BLOCK IS JUST TO GENERATE DUMMY 'Y' 'N' DATA COMPUTE SL1/I2= SEATS -1; NOPRINT COMPUTE SL2/I2= SEATS -2; NOPRINT COMPUTE SL3/I2= SEATS -3; NOPRINT COMPUTE YN1/A10=IF SL1 GE 1 THEN 'Y' ELSE 'N'; COMPUTE YN2/A10=IF SL2 GE 1 THEN 'Y' ELSE 'N'; COMPUTE YN3/A10=IF SL3 GT 1 THEN 'Y' ELSE 'N'; -* ENDBLOCK COMPUTE SL1C/I2= IF YN1 EQ 'Y' THEN 1 ELSE 0; NOPRINT COMPUTE SL2C/I2= IF YN2 EQ 'Y' THEN 1 ELSE 0; NOPRINT COMPUTE SL3C/I2= IF YN3 EQ 'Y' THEN 1 ELSE 0; NOPRINT COMPUTE COLPCT/D5.1%= ((SL1C+SL2C+SL3C)/3)*100; NOPRINT COMPUTE PCTROW/A10=FTOA(COLPCT, '(D5.1%)', 'A10');
BY MODEL ON TABLE SET HOLDLIST PRINTONLY ON TABLE HOLD AS RAWDATA FORMAT ALPHA END -RUN FILEDEF RAWDATA DISK RAWDATA.FTM (APPEND -RUN DEFINE FILE RAWDATA ISROW/I2=1; SL1C/I2= IF YN1 EQ 'Y' THEN 1 ELSE 0; SL2C/I2= IF YN2 EQ 'Y' THEN 1 ELSE 0; SL3C/I2= IF YN3 EQ 'Y' THEN 1 ELSE 0; END TABLE FILE RAWDATA SUM SL1C NOPRINT SL2C NOPRINT SL3C NOPRINT ISROW NOPRINT COMPUTE MODELX/A24= 'Percetage'; COMPUTE PROW/I5=99999; COMPUTE PCTCOL1/D5.1%= (C1/C4)*100; NOPRINT COMPUTE PCTCOL2/D5.1%= (C2/C4)*100; NOPRINT COMPUTE PCTCOL3/D5.1%= (C3/C4)*100; NOPRINT COMPUTE APCT1/A10=FTOA(PCTCOL1, '(D5.1%)', 'A10'); COMPUTE APCT2/A10=FTOA(PCTCOL2, '(D5.1%)', 'A10'); COMPUTE APCT3/A10=FTOA(PCTCOL3, '(D5.1%)', 'A10'); ON TABLE SET HOLDLIST PRINTONLY ON TABLE SAVE AS RAWDATA END -RUN TABLE FILE RAWDATA PRINT YN1 AS '' YN2 AS '' YN3 AS '' PCTROW AS '' BY PROW NOPRINT BY MODEL AS '' ON TABLE SET PAGE NOLEAD END
-* This bit shows how to find the no of across columns TABLE FILE CAR SUM SEATS ACROSS CAR BY MODEL ON TABLE HOLD AS BASEDATA END -RUN CHECK FILE BASEDATA HOLD -RUN TABLE FILE HOLD SUM MAX.FLDNO ON TABLE SAVE FORMAT ALPHA END -RUN -READ SAVE &COLS.A4. -* SET THE NUMBER OF BYs as a variable -SET &NOBYS=1; -* SET THE ACROSS VARIABLE = TOTAL COLUMNS - NUMBER OF BY COLUMNS -SET &ACROSS=&COLS - &NOBYS; -* -* SETTING ACROSS TO 3 as we do not have a real across -SET &ACROSS=3; TABLE FILE CAR SUM COMPUTE PROW/I5= LAST PROW +1; -* -* THIS BLOCK IS JUST TO GENERATE DUMMY 'Y' 'N' DATA COMPUTE SL1/I2= SEATS -1; NOPRINT COMPUTE SL2/I2= SEATS -2; NOPRINT COMPUTE SL3/I2= SEATS -3; NOPRINT COMPUTE E02/A10=IF SL1 GE 1 THEN 'Y' ELSE 'N'; NOPRINT COMPUTE E03/A10=IF SL2 GE 1 THEN 'Y' ELSE 'N'; NOPRINT COMPUTE E04/A10=IF SL3 GT 1 THEN 'Y' ELSE 'N'; NOPRINT -* ENDBLOCK -SET &CNT1=0; -REPEAT LOOP1 &ACROSS.EVAL TIMES -SET &CNT1=&CNT1+1; -SET &NECOL=&CNT1 + &NOBYS ; -SET &ECOL=IF &CNT1 LE 10 THEN '0'|&NECOL ELSE &CNT1 + &NECOL; E&ECOL.EVAL AS 'TN&CNT1.EVAL' COMPUTE SL&CNT1.EVALC/I2= IF E&ECOL.EVAL EQ 'Y' THEN 1 ELSE 0; NOPRINT -LOOP1 COMPUTE COLPCT/D5.1%= (( -SET &CNT2=0; -REPEAT LOOP2 &ACROSS.EVAL TIMES -SET &CNT2=&CNT2+1; SL&CNT2.EVALC + -LOOP2 0)/&ACROSS )*100; NOPRINT COMPUTE PCTROW/A10=FTOA(COLPCT, '(D5.1%)', 'A10'); BY MODEL ON TABLE SET ASNAMES ON ON TABLE SET HOLDLIST PRINTONLY ON TABLE HOLD AS RAWDATA FORMAT ALPHA END -RUN FILEDEF RAWDATA DISK RAWDATA.FTM (APPEND -RUN DEFINE FILE RAWDATA ISROW/I2=1; -SET &CNT3=0; -REPEAT LOOP3 &ACROSS.EVAL TIMES -SET &CNT3=&CNT3+1; SL&CNT3.EVALC/I2= IF TN&CNT3.EVAL EQ 'Y' THEN 1 ELSE 0; -LOOP3 END TABLE FILE RAWDATA SUM -SET &CNT4=0; -REPEAT LOOP4 &ACROSS.EVAL TIMES -SET &CNT4=&CNT4+1; SL&CNT4.EVALC NOPRINT -LOOP4 ISROW NOPRINT COMPUTE MODELX/A24= 'Percetage'; COMPUTE PROW/I5=99999; -SET &CNT5=0; -REPEAT LOOP5 &ACROSS.EVAL TIMES -SET &CNT5=&CNT5+1; COMPUTE PCTCOL&CNT5.EVAL/D5.1%= (C&CNT5.EVAL/ISROW)*100; NOPRINT COMPUTE APCT1&CNT5.EVAL/A10=FTOA(PCTCOL&CNT5.EVAL, '(D5.1%)', 'A10'); -LOOP5
ON TABLE SET HOLDLIST PRINTONLY ON TABLE SAVE AS RAWDATA END -RUN TABLE FILE RAWDATA PRINT -SET &CNT6=0; -REPEAT LOOP6 &ACROSS.EVAL TIMES -SET &CNT6=&CNT6+1; TN&CNT6.EVAL AS '' -LOOP6 PCTROW AS '' BY PROW NOPRINT BY MODEL AS '' ON TABLE SET PAGE NOLEAD END
It would be nice if Vinod should give any reaction so we all know if the answers are helpful. It's a bit like my internal clients, they ask and explain the problem just a bit and do think to know that we understand their problem and solve it.....
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006
here is the code i am using to find row percentages. _______________________________________________ SET ASNAMES=ON SET LINES=9999 JOIN T_SQL_UGT_NEWS_RESP_E.T_SQL_UGT_NEWS_RESP_E.MSG_I IN T_SQL_UGT_NEWS_RESP_E TO MULTIPLE T_SQL_UGT_NEWS_MSG_E.T_SQL_UGT_NEWS_MSG_E.MSG_I IN T_SQL_UGT_NEWS_MSG_E AS J0 END DEFINE FILE T_SQL_UGT_NEWS_RESP_E CRESP/I2 = IF RESP_C EQ 'C' THEN 1 ELSE 0 ; UPDT/YYMD = HDATE(UPDT_TS, 'YYMD'); END TABLE FILE T_SQL_UGT_NEWS_RESP_E SUM CRESP AS 'RESP' NOPRINT BY MSG_SUBJ_T SUM RESP_C BY MSG_SUBJ_T ACROSS LOC_I COMPUTE PCT/D4% = C1/5 * 100; WHERE LOC_I IN ( 3 4 5 13 19) WHERE UPDT EQ '2008/04/11' HEADING "Urgent News" END _____________________________________________
My question: I need to find the column percentages too.
I would calculate the percentages first and put them in an hold file.
TABLE FILE T_SQL_UGT_NEWS_RESP_E
SUM
CRESP
BY LOC_I
COMPUTE PCTTOT/D4% = CRESP/5 * 100;
COMPUTE TCODE/A1='T';
WHERE LOC_I IN ( 3 4 5 13 19)
WHERE UPDT EQ '2008/04/11'
ON TABLE HOLD AS HOLDTOT
END
This will give you something like
3 100% T
4 80% T
5 60% T
13 40% T
19 40% T
Now if you add the 'TCODE' to your first query and instead of 'T' you use 'D' and put that in a holdfile too, you have two tables which you can combine.
But not yet....
the challange you now have is that the format of the fields are different. The detail table has alpha field (Y and N) the Total table has numbers.
You also can just run the first report and the second as a separate report that just shows you the totals.
TABLE FILE HOLDTOT
SUM PCTTOT
ACROSS LOC_I
END
I hope I have made you glad.....
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006
I tried this and it seems to work. You will need to display the recapped percentages in a subfooting and work on aligning them with the columns.
I did the HOLD file ONLY to get some data to work with. What you need is from TABLE FILE H1.
_* This step is only to get data to use since I didn't have your table to work with.
DEFINE FILE GGORDER
ORD_MON/M=ORDER_DATE;
END
TABLE FILE GGORDER
SUM COMPUTE CRESP/I9 = IF QUANTITY GT 600 THEN 1 ELSE 0;
BY STORE_CODE
BY PRODUCT_CODE
BY ORD_MON
WHERE ( ORD_MON GE '1' ) AND ( ORD_MON LE '5' );
WHERE STORE_CODE EQ 'R1019';
ON TABLE HOLD AS H1
END
-RUN
-*
-*
-* The real code starts here.
-*
-*
-*
TABLE FILE H1
SUM
CRESP NOPRINT
COMPUTE PROD_CNT/I9 = 1; NOPRINT
BY STORE_CODE
BY PRODUCT_CODE
SUM
CRESP
BY STORE_CODE
BY PRODUCT_CODE
ACROSS ORD_MON
COMPUTE C_PCT/D4% = C1/5 * 100;
ON TABLE RECAP
COL1_PCT/D4% = C3/PROD_CNT * 100;
COL2_PCT/D4% = C4/PROD_CNT * 100;
COL2_PCT/D4% = C5/PROD_CNT * 100;
COL2_PCT/D4% = C6/PROD_CNT * 100;
COL2_PCT/D4% = C7/PROD_CNT * 100;
END
ttfn, kp
Access to most releases from R52x, on multiple platforms.
Posts: 346 | Location: Melbourne Australia | Registered: April 15, 2003