Hello all - I have hit just about every post out there trying to accomplish by goal, but just can't seem to get it to work. I am summing two fields (on a COMPUTE) ACROSS a field. I only want a row total for one of the fields but column totals for both. I'm also having trouble recomputing my compute. Here is what I have: DEFINE FILE MYTABLE COUNTER/I8=1; END TABLE FILE MYTABLE SUM COUNTER COMPUTE CHG_PCT/D12.2% = ( ( COUNTER - LAST COUNTER ) / LAST COUNTER ) * 100; BY 'HI_LEV' NOPRINT BY 'REGION' AS 'Region' ACROSS 'OPENWEEK' ON HI_LEV RECOMPUTE MULTILINES AS 'Total For ' ON TABLE SUMMARIZE COUNTER CHG_PCT AS 'TOTAL' END
Thanks all.This message has been edited. Last edited by: Kerry,
WF (App Studio) 8.2.01m / Windows Mainframe FOCUS 8
March 06, 2009, 03:21 PM
FrankDutch
Take a look at the multiverb functionality. That will give you the ability to compute the row total for one specific field.
something like
DEFINE FILE MYTABLE
COUNTER/I8=1;
COUNTER2/I5=1;
END
TABLE FILE MYTABLE
SUM
COUNTER2
BY HI_LEV NOPRINT
BY REGION NOPRINT
SUM
COUNTER
COMPUTE CHG_PCT/D12.2% = ( ( COUNTER - LAST COUNTER ) / LAST COUNTER ) * 100;
BY 'HI_LEV' NOPRINT
BY 'REGION' AS 'Region'
ACROSS OPENWEEK
ON HI_LEV RECOMPUTE MULTILINES AS 'Total For '
ON TABLE SUMMARIZE COUNTER CHG_PCT AS 'TOTAL'
END
Now your "rowtotal" will be seen in the first column, but you can use it in a computed field after the across.
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
March 06, 2009, 04:06 PM
BobV
Frank, thanks for the quick response. I see how this works, but when I use it my column totals get goofed up. Totals show for only the COUNTER2 and the first column in the across for COUNTER. Still can't get my recompute to work for PCT_CHG.
WF (App Studio) 8.2.01m / Windows Mainframe FOCUS 8
March 06, 2009, 04:18 PM
FrankDutch
Bob
try to be a bit more specific on the field you do want a row total. You can selective total one or more columns.
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
March 06, 2009, 04:43 PM
BobV
I only want a row total on the COUNTER field I am defining. Not the CHG_PCT that I am computing. However, I would still like column totals for both and have CHG_PCT recompute since is a % calculation.
Like this: week1 week2 week3 WEEK4 TOTAL Region COUNTER CHG_PCT COUNTER CHG_PCT COUNTER CHG_PCT COUNTER CHG_PCT COUNTER AAA 8 . 4 -50% 2 -50% 4 100% 18 BBB 1 . 1 0% 2 100% 6 200% 10 REGION TOT 9 . 5 -44% 4 -20% 10 150% 28
Thanks.
WF (App Studio) 8.2.01m / Windows Mainframe FOCUS 8
March 07, 2009, 07:58 AM
FrankDutch
Your (or mine) COUNTER2 is the same value as COUNTER so if you use the report as I suggested above the value of COUNTER2 should be the row sum of COUNTER.
After your code
...
ON TABLE SUMMARIZE COUNTER CHG_PCT AS 'TOTAL'
RECAP TOTCOUNT=C1; AS 'Total Counter'
END
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
March 07, 2009, 08:18 AM
Tom Flynn
Can't use RECAP without a SUBFOOT, except in FML; this isn't FML...
1) lets you control which variable you want to handle as a row summary calculation: TABLE FILE CAR SUM SALES AS TOTSALES NOPRINT BY CAR SUM SALES COST ACROSS COUNTRY AND COMPUTE MYSALESTOTAL/D8=C1; BY CAR
double verbs and noprint
2) use ON TABLE COLUMN-TOTAL {fieldname(s)} rather than SUMMARIZE, and it won't try to crank something it can't crank, just sums it up. so your % columns add to 100, if that's what they're s'posed to do.
is this what you wanted? -s
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
March 09, 2009, 08:29 AM
GamP
Something like this perhaps?
DEFINE FILE MYTABLE
COUNTR1/I8=1;
COUNTR2/I8=1;
END
TABLE FILE MYTABLE
SUM COUNTR1 NOPRINT
BY 'HI_LEV'
SUM COUNTR2
COMPUTE CHG_PCT/D12.2% = IF HI_LEV NE LAST HI_LEV THEN 0 ELSE
( ( COUNTR2 - LAST COUNTR2 ) / LAST COUNTR2 ) * 100;
BY 'HI_LEV'
ACROSS 'OPENWEEK'
COMPUTE TOTCOL/I8 = C1 ; AS 'Total'
ON TABLE SUBTOTAL AS 'Total'
END
Hope this helps ...
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
March 09, 2009, 11:19 AM
BobV
susannah, the following worked for me: DEFINE FILE TABLE1 COUNTER/I8=1; COUNT_TOT/I8=1; END TABLE FILE TABLE1 SUM COUNT_TOT NOPRINT AS 'COUNT_TOT' BY HI_LEV' NOPRINT BY REGION' AS 'Region' SUM COUNTER/I8C AS 'Accts Opnd' COMPUTE CHG_PCT/D12% = IF OPENWEEK EQ 'February 2, 2009' THEN 0 ELSE ( ( COUNTER - LAST COUNTER ) / LAST COUNTER ) * 100; AS 'Pct Chg,Prior Week' BY HI_LEV' NOPRINT BY REGION' AS 'Region' ACROSS 'DDA_ACCT_HIGH_ACTV.DDA_ACCT_HIGH_ACTV.OPENWEEK' AND COMPUTE COUNT_TOTAL/I8 = C1; AS 'Total Accts Opnd' ON HI_LEV SUBTOTAL AS 'Totals for ' ON TABLE COLUMN-TOTAL AS 'GRAND TOTAL' COUNTER CHG_PCT
The RECOMPUTE is not working as hoped. It should recompute CHG_PCT by my calculation at the COLUMN-TOTAL: REGION WEEK1 WEEK2 WEEK3 TOTAL COUNTER | CHG_PCT | COUNTER | CHG_PCT | COUNTER | CHG_PCT | COUNTER AAAA 10 | 0 | 5 | -50% | 2 | -60% | 17 BBBB 7 | 0 | 9 | 28% | 11 | 22% | 27 TOTAL 17 | 0 | 14 | -17% | 13 | -7% | 44
I've tried all combinations of RECOMPUTE and just can't get it to work. But the row total issue I was having is solved. Thanks to all who took the time to respond.
BobV
quote:
Originally posted by susannah: 1) lets you control which variable you want to handle as a row summary calculation: TABLE FILE CAR SUM SALES AS TOTSALES NOPRINT BY CAR SUM SALES COST ACROSS COUNTRY AND COMPUTE MYSALESTOTAL/D8=C1; BY CAR
double verbs and noprint
2) use ON TABLE COLUMN-TOTAL {fieldname(s)} rather than SUMMARIZE, and it won't try to crank something it can't crank, just sums it up. so your % columns add to 100, if that's what they're s'posed to do.
is this what you wanted? -s
WF (App Studio) 8.2.01m / Windows Mainframe FOCUS 8