Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Running Total Reset

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Running Total Reset
 Login/Join
 
Master
posted
Essentially, the code below is succefully creating a running total for the 4 fields shown. The trouble is the running total should reset itself when the BaNbr changes.

It does not and I am unsure why?

TABLE FILE ANALYZER_INVOICE_VW
SUM
COMPUTE RUNNING_TOTAL_CHGS_ACT/D12.2 = ANALYZER_INVOICE_VW.TRANSACTION.TRX_CHARGE_AMOUNT + LAST RUNNING_TOTAL_CHGS_ACT; AS 'ChgsAct'
COMPUTE RUNNING_TOTAL_WRVUS_ACT/D12.2 = ANALYZER_INVOICE_VW.CPTCODES.wRVUs + LAST RUNNING_TOTAL_WRVUS_ACT; AS 'WrvusAct'
COMPUTE RUNNING_TOTAL_UNITS_ACT/D12.2 = ANALYZER_INVOICE_VW.CPTCODES.UNITS + LAST RUNNING_TOTAL_UNITS_ACT; AS 'UnitsAct'
COMPUTE RUNNING_TOTAL_VISIT_ACT/D12.2 = J1.TBLMSTR_CPTCODEPROCATXREF.VISIT_ACT + LAST RUNNING_TOTAL_VISIT_ACT; AS 'VisitsAct'
COMPUTE RUNNING_TOTAL_PROCEDURE_ACT/D12.2 = J1.TBLMSTR_CPTCODEPROCATXREF.PROCEDURE_ACT + LAST RUNNING_TOTAL_PROCEDURE_ACT; AS 'ProcsAct'
BY LOWEST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum AS 'BaNbr'
BY LOWEST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingName AS 'BaName'
BY LOWEST ANALYZER_INVOICE_VW.TRANSACTION.TRX_PostingDt_Period AS 'PD'
BY LOWEST ANALYZER_INVOICE_VW.TRANSACTION.TRX_PostingDt
WHERE ANALYZER_INVOICE_VW.TRANSACTION.TRX_PostingDt_Period EQ &TRX_PostingDt_Period.(AND(FIND TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.PERIODTEXT,TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.PERIODTEXT IN tblmstr_calendarperiod)).Select the desired Period/s.;
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS RNNGTOTALSACT FORMAT ALPHA
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Silver Member
posted Hide Post
TABLE FILE CAR
SUM COMPUTE
    MODELCNT/D12 = CNT.MODEL ;
	COMPUTE
    CUM_MODELCNT/D12 = IF COUNTRY EQ LAST COUNTRY THEN (LAST CUM_MODELCNT + 1) ELSE MODELCNT ;
BY COUNTRY
BY MODEL
END  


Robert,

see the code using the CAR file. you can extend the logic for LAST to account for a change in some BY field. basically you want to the cumulative / running total to change for BaNbr


7.7.04
Win2K3, Unix
Oracle 10G,SQL2K,XFOCUS,ESRI,BID,MRE,SELF-SERVICCE
 
Posts: 36 | Location: Melville,NY | Registered: August 09, 2004Report This Post
Master
posted Hide Post
Hmmm...seems to make perfect sense but upon doing so, I loose my running totals alltogether...

TABLE FILE ANALYZER_INVOICE_VW
-*WHERE ( ANALYZER_INVOICE_VW.TRANSACTION.TRX_PostingDt_Period ) EQ &PRD
-* COMPUTE RUNNING_TOTAL_CHGS_ACT/D12.2 = IF ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum EQ LAST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum THEN ANALYZER_INVOICE_VW.TRANSACTION.TRX_CHARGE_AMOUNT + LAST RUNNING_TOTAL_CHGS_ACT ELSE ANALYZER_INVOICE_VW.TRANSACTION.TRX_CHARGE_AMOUNT; AS 'ChgsAct'
-* COMPUTE RUNNING_TOTAL_UNITS_ACT/D12.2 = IF ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum EQ LAST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum THEN ANALYZER_INVOICE_VW.CPTCODES.UNITS + LAST RUNNING_TOTAL_UNITS_ACT ELSE ANALYZER_INVOICE_VW.CPTCODES.UNITS; AS 'UnitsAct'
-* COMPUTE RUNNING_TOTAL_VISIT_ACT/D12.2 = IF ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum EQ LAST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum THEN J1.TBLMSTR_CPTCODEPROCATXREF.VISIT_ACT + LAST RUNNING_TOTAL_VISIT_ACT ELSE J1.TBLMSTR_CPTCODEPROCATXREF.VISIT_ACT; AS 'VisitsAct'
-* COMPUTE RUNNING_TOTAL_PROCEDURE_ACT/D12.2 = IF ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum EQ LAST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum THEN J1.TBLMSTR_CPTCODEPROCATXREF.PROCEDURE_ACT + LAST RUNNING_TOTAL_PROCEDURE_ACT ELSE J1.TBLMSTR_CPTCODEPROCATXREF.PROCEDURE_ACT; AS 'ProcsAct'
SUM
COMPUTE RUNNING_TOTAL_WRVUS_ACT/D12.2 = IF ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum EQ LAST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum THEN ( ANALYZER_INVOICE_VW.CPTCODES.wRVUs + LAST RUNNING_TOTAL_WRVUS_ACT ) ELSE ANALYZER_INVOICE_VW.CPTCODES.wRVUs; AS 'WrvusAct'
BY LOWEST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum AS 'BaNbr'
BY LOWEST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingName AS 'BaName'
BY LOWEST ANALYZER_INVOICE_VW.TRANSACTION.TRX_PostingDt_Period AS 'PD'
BY LOWEST ANALYZER_INVOICE_VW.TRANSACTION.TRX_PostingDt
WHERE ANALYZER_INVOICE_VW.TRANSACTION.TRX_PostingDt_Period EQ &TRX_PostingDt_Period.(AND(FIND TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.PERIODTEXT,TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.PERIODTEXT IN tblmstr_calendarperiod)).Select the desired Period/s.;
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS RNNGTOTALSACT FORMAT ALPHA
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Master
posted Hide Post
Cleaned it up...still no running total now...not sure why?

TABLE FILE ANALYZER_INVOICE_VW
SUM
COMPUTE CMPWRVUS/D12.2 = ANALYZER_INVOICE_VW.CPTCODES.wRVUs;
COMPUTE RUNNING_TOTAL_WRVUS_ACT/D12.2 = IF ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum EQ LAST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum THEN ( LAST RUNNING_TOTAL_WRVUS_ACT + ANALYZER_INVOICE_VW.CPTCODES.wRVUs ) ELSE CMPWRVUS; AS 'WrvusAct'
BY ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum AS 'BaNbr'
BY LOWEST ANALYZER_INVOICE_VW.TRANSACTION.TRX_PostingDt
WHERE ANALYZER_INVOICE_VW.TRANSACTION.TRX_PostingDt_Period EQ 201307;
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET BYDISPLAY ON
ON TABLE NOTOTAL
ON TABLE HOLD AS RNNGTOTALSACT FORMAT ALPHA
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Master
posted Hide Post
Interesting...I put a switch in there (below)and ran the report with just the switch...it appears to correctly flip from Y to N as the BaNbr changes...I am thinking that the running total is suddenly not working do to some ort of syntax issue?

COMPUTE SWITCH/A1 = IF ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum EQ LAST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum THEN 'Y' ELSE 'N'; AS 'Switch'


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Master
posted Hide Post
****CLOSED***********

This code appears to work...


TABLE FILE ANALYZER_INVOICE_VW
BY LOWEST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum AS 'BaNbr'
BY LOWEST ANALYZER_INVOICE_VW.TRANSACTION.TRX_PostingDt
BY LOWEST COMPUTE SWITCH/A1 = IF ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum EQ LAST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum THEN 'Y' ELSE 'N'; AS 'Switch'
BY LOWEST COMPUTE RUNNING_TOTAL_WRVUS_ACT/D12.2 = IF ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum EQ LAST ANALYZER_INVOICE_VW.INVOICE.Billing_Area_ReportingNum THEN ( LAST RUNNING_TOTAL_WRVUS_ACT + ANALYZER_INVOICE_VW.CPTCODES.wRVUs ) ELSE ANALYZER_INVOICE_VW.CPTCODES.wRVUs; AS 'WrvusRnng'
WHERE ANALYZER_INVOICE_VW.TRANSACTION.TRX_PostingDt_Period EQ 201307;
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET BYDISPLAY ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
-*ON TABLE HOLD AS RNNGTOTALSACT FORMAT ALPHA
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Master
posted Hide Post
Robert (and others): I know the standard advice these days is to use fully-qualified field names in your code, but when posing (or even posting) on here it makes it a LOT easier to understand what you are getting at if you either use the CAR file or alternatively simplify your code.

For example:
COMPUTE RUNNING_TOTAL/D12.2 = IF ReportingNum EQ LAST ReportingNum THEN ( LAST WRVUS_ACT + wRVUs ) ELSE CMPWRVUS;


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report This Post
Master
posted Hide Post
I will do so in the future.


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Running Total Reset

Copyright © 1996-2020 Information Builders