Focal Point
[CLOSED] producing just totals on a defined column

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9801077813

February 18, 2009, 01:37 PM
DaveZ
[CLOSED] producing just totals on a defined column
I have created several defines in my fex the openbalance and closing defines, the user wants to see just totals when it breaks on the transaction type(TT) and on the accountno is this possible/ and is so how ?

DEFINE FILE WF_GL_DETAIL_VIEW ADD
Debits/D15.2=IF PERIOD EQ 10 AND FISCAL_YEAR EQ 2009 AND TRANSAMNT GE 0 THEN TRANSAMNT ELSE 0;
Credits/D15.2=IF PERIOD EQ 10 AND FISCAL_YEAR EQ 2009 AND TRANSAMNT LT 0 THEN TRANSAMNT ELSE 0;
OPENBALANCE/D17.2=IF PERIOD LT 10 AND FISCAL_YEAR EQ 2009 AND TRANSAMNT NE -0 THEN TRANSAMNT ELSE 0;
TRANQTY/D15.2=IF PERIOD EQ 10 AND FISCAL_YEAR EQ 2009 AND TRANSQTY NE -0 THEN TRANSQTY ELSE 0;
TRANDT/MDYY=IF PERIOD EQ 10 AND FISCAL_YEAR EQ 2009 THEN WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.TRANSDATE;
REF/A20=IF PERIOD EQ 10 AND FISCAL_YEAR EQ 2009 THEN REFERENCENO;
CLOSING/D17.2=OPENBALANCE + Credits + Debits;
END
TABLE FILE WF_GL_DETAIL_VIEW
SUM
'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.TRANQTY' AS 'Qty'
'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.Debits' AS 'Debit'
'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.Credits' AS 'Credit'
'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.OPENBALANCE' AS 'Opening Bal'
'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.CLOSING' AS 'Closing Bal'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.CENTER' NOPRINT AS 'Ctr'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNO' AS 'Account,Number'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNAME' AS 'Description'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.TRANSTYPE' AS 'TT'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.TRANDT' AS 'Transdate'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.REF' AS 'Reference,Number'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.PERIOD' NOPRINT AS 'Per,'
PRINT
'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.COMMENT_TEXT' AS 'COMMENT'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.CENTER' NOPRINT AS 'Ctr'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNO' AS 'Account,Number'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNAME' AS 'Description'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.TRANSTYPE' AS 'TT'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.TRANDT' AS 'Transdate'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.REF' AS 'Reference,Number'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.PERIOD' NOPRINT AS 'Per,'

ON WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.CENTER SUBTOTAL AS '*Total For Center'

ON WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNO SUBTOTAL AS '*Total For Account'

ON WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.TRANSTYPE SUBTOTAL AS '*Total For TT'
HEADING
"&DATEtMDYY <+0> &TOD"
"P C C S T R U C T U R A L S, I N C."
"Cost Center Ranges : Detail Financial Report"
"By Cost Center, Acct Number, Trans Type and Transaction Date"
"For Period &PERIOD.Period:. Fiscal Year &FISCALYEAR.Fiscal Year:."
" "
WHERE ( WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.PERIOD LE &PERIOD ) AND ( WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.FISCAL_YEAR EQ &FISCALYEAR ) AND ( WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.PLANT GE '&PLANT1.Plant GE: Plant Is 2 Digits.' ) AND ( WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.PLANT LE '&PLANT2.Plant LE: Plant Is 2 Digits.' );
ON TABLE SET PAGE-NUM ON
ON TABLE COLUMN-TOTAL AS '** Grand Total'
ON TABLE PCHOLD FORMAT PDF

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.7.1
Windows 2000
Output: Excel and PDF
February 18, 2009, 02:15 PM
GinnyJakes
It doesn't matter if the columns are defined fields or not. You can specify which columns you want to show the total for. Here is an example from the car file:
TABLE FILE CAR
PRINT SALES RCOST DCOST
BY COUNTRY 
BY CAR
BY MODEL
ON CAR SUBTOTAL RETAIL_COST
ON TABLE SUBTOTAL RETAIL_COST
END



Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
February 18, 2009, 04:54 PM
DaveZ
please look at my code I want to print the total for this field called "openbalance" which is a defined field, and only what it to print after the break by "accountno" the user only wants to see this total once( does not want to see the detail amounts).


WebFOCUS 7.7.1
Windows 2000
Output: Excel and PDF
February 18, 2009, 05:52 PM
j.gross
Here's an approach to try:

calculate the opening and closing bal, and the number of detail rows, at the account level (another SUM, with NOPRINT on its dependent columns and fewer BY's). calculate the row number within its account for each detail record. Now you can identify the first and last detail line for each account break.

calculate the displayed opening balance column for the first row of the account as the account-level opening bal, and zero for all the other rows; give it a computed format, defined to print normally when it's the first row, and with 'S' suffix, so it shoots blanks, if it's any other row.

Similarly for the closing balance (to print with either the first or last detail row of the account, as you wish)
February 23, 2009, 06:19 PM
DaveZ
I trimmed my by's to 3, I created a new define field called count_record, where do I do the define to print normally when it row one and the 'S' suffix if not row one?

DEFINE FILE WF_GL_DETAIL_VIEW ADD
OPENBAL/D17.2=IF PERIOD LT &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR THEN TRANSAMNT ELSE 0;
count_record/I5 = IF TRANSAMNT THEN count_record + 1 ELSE 0;
Debits/D15.2=IF PERIOD = &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR AND TRANSAMNT GE 0 THEN TRANSAMNT ELSE 0;
Credits/D15.2=IF PERIOD = &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR AND TRANSAMNT LT 0 THEN TRANSAMNT ELSE 0;
REF/A12=IF PERIOD EQ &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR THEN REFERENCENO;
COM/A12=IF PERIOD EQ &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR THEN COMMENT_TEXT;
QTY/D12=IF PERIOD EQ &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR THEN TRANSQTY ELSE 0;
TT/A2=IF PERIOD EQ &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR THEN TRANSTYPE;
TD/MDYY=IF PERIOD EQ &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR THEN TRANSDATE;

END
TABLE FILE WF_GL_DETAIL_VIEW
SUM
'OPENBAL' AS 'Opening,Balance'
'COUNT_RECORD' NOPRINT
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.CENTER' NOPRINT AS 'Ctr'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNO' AS 'Account,Number'
BY 'TT'
BY 'TD' AS 'Transdate'
PRINT
'REF' AS 'Reference,Number'
'COM' AS 'Comment'
'QTY' AS 'Qty'
'Debits' AS 'Debit'
'Credits' AS 'Credit'
'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNAME' AS 'Description'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.CENTER' NOPRINT AS 'Ctr'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNO' AS 'Account,Number'
BY 'TT'
BY 'TD' AS 'Transdate'
ON WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.CENTER SUBTOTAL AS '*Total For Center'

ON WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNO SUBTOTAL AS '*Total For Account'

ON TT SUBTOTAL AS '*Total For TT'
HEADING


WebFOCUS 7.7.1
Windows 2000
Output: Excel and PDF
February 24, 2009, 06:35 PM
DaveZ
I am having a problem getting the count(rownum) to work the way I would like it to work, when it hits a new accountno I want it to set the count back to zero.
COMPUTE ROWNUM/I5 = IF ACCOUNTNO EQ LAST ACCOUNTNO THEN ROWNUN +1 ELSE 0;

this is the complete code:

DEFINE FILE WF_GL_DETAIL_VIEW ADD
OPENBAL/D17.2=IF PERIOD LT &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR THEN TRANSAMNT ELSE 0;
Debits/D15.2=IF PERIOD = &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR AND TRANSAMNT GE 0 THEN TRANSAMNT ELSE 0;
Credits/D15.2=IF PERIOD = &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR AND TRANSAMNT LT 0 THEN TRANSAMNT ELSE 0;
REF/A12=IF PERIOD EQ &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR THEN REFERENCENO;
COM/A12=IF PERIOD EQ &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR THEN COMMENT_TEXT;
QTY/D12=IF PERIOD EQ &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR THEN TRANSQTY ELSE 0;
TT/A2=IF PERIOD EQ &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR THEN TRANSTYPE;
TD/MDYY=IF PERIOD EQ &PERIOD AND FISCAL_YEAR EQ &FISCALYEAR THEN TRANSDATE;

END
TABLE FILE WF_GL_DETAIL_VIEW
SUM
COMPUTE ROWNUM/I5 = IF ACCOUNTNO EQ LAST ACCOUNTNO THEN ROWNUN +1 ELSE 0;
'OPENBAL' AS 'Opening,Balance'

BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.CENTER' NOPRINT AS 'Ctr'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNO' AS 'Account,Number'
BY 'TT'
BY 'TD' AS 'Transdate'
PRINT
'REF' AS 'Reference,Number'
'COM' AS 'Comment'
'QTY' AS 'Qty'
'Debits' AS 'Debit'
'Credits' AS 'Credit'
'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNAME' AS 'Description'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.CENTER' NOPRINT AS 'Ctr'
BY 'WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNO' AS 'Account,Number'
BY 'TT'
BY 'TD' AS 'Transdate'
ON WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.CENTER SUBTOTAL AS '*Total For Center'

ON WF_GL_DETAIL_VIEW.WF_GL_DETAIL_VIEW.ACCOUNTNO SUBTOTAL AS '*Total For Account'

ON TT SUBTOTAL AS '*Total For TT'
HEADING
"&DATEtMDYY <+0> &TOD"


WebFOCUS 7.7.1
Windows 2000
Output: Excel and PDF
February 25, 2009, 08:56 AM
GamP
quote:
COMPUTE ROWNUM/I5 = IF ACCOUNTNO EQ LAST ACCOUNTNO THEN ROWNUN +1 ELSE 0;

I take it that you have already noticed the typo? (rownuN iso rownuM).


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
February 25, 2009, 09:03 AM
jgelona
Try:
COMPUTE ROWNUM/I5 = IF ACCOUNTNO EQ LAST ACCOUNTNO THEN LAST ROWNUM+1 ELSE 0;


You have ROWNUN in your THEN clause. If you want ROWNUM to start with 0, then this should work. If you want it to start with 1, change the 0 to 1.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
February 25, 2009, 11:16 AM
DaveZ
Thanks I have fixed the typo, I still have a problem on the breaks, when it breaks on the accountno I get 0 and that's what I want but with in that account it breaks on TT and that is also 0, I want to print open bal on just the break of accountno when rownum is 0 not every 0.


WebFOCUS 7.7.1
Windows 2000
Output: Excel and PDF
February 26, 2009, 05:07 AM
GamP
DaveZ,

But the sum of the open balance is calculated for each mentioned sort field. If you would print only the open balance when the account number changes value, then you would lose all openbalances for all underlying levels.
I would try and see if the desired result is achieved when you remove the by tt and by td phrases from the first request set (under the sum that is). Leave them under the print.

Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
February 26, 2009, 11:45 AM
DaveZ
It is closer, I need to get the rownum at the detail level, or by pass the count "ON TT SUBTOTAL" it shows 0 at that "ON TT SUBTOTAL" level so then it prints the open bal which I don't want it to print there.

Thanks for all the help


WebFOCUS 7.7.1
Windows 2000
Output: Excel and PDF