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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
running total
 Login/Join
 
Silver Member
posted
how to compute for the running total in a report?

ITEM AMOUNT TOTAL AMOUNT
AAAA 123.00 123.00
BBBB 100.00 223.00
CCCC 50.00 273.00

i though using the LAST function will solve the problem but it won't since the AMOUNT column is the sum of all same items.

thanks in advance for all the help!


WebFocus 762 AS400 / DB2
 
Posts: 34 | Location: Winnipeg, MB | Registered: January 23, 2008Report This Post
Virtuoso
posted Hide Post
LAST is the right answer:

TABLE FILE CAR
SUM RCOST
COMPUTE RUN_TOT=LAST RUN_TOT + RCOST;
BY COUNTRY
END

gets you

COUNTRY RETAIL_COST RUN_TOT
ENGLAND 45,319 45,319.00
FRANCE 5,610 50,929.00
ITALY 51,065 101,994.00
JAPAN 6,478 108,472.00
W GERMANY 64,732 173,204.00


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
Noel

Try this, using LAST:
TABLE FILE CAR
SUM SALES
COMPUTE RUNNING_TOTAL = SALES + LAST RUNNING_TOTAL;
BY COUNTRY
END


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Silver Member
posted Hide Post
quote:
LAST RUN_TOT

Thanks a lot for the ideas that you shared.
I missed to mention one thing in one of the colums we use the PCT prefix to cumpute for the percentage. here are the actual codes that i have.

TABLE FILE MBF9REP
SUM
'AVE.MBDDREP.MBDDREP.AvePrice' AS 'Average, Price'
'MBDDREP.MBDDREP.DDARQT' AS 'Overall, Sales, (Units)'
'MBDDREP.MBDDREP.DDDUVA' AS 'Consumption, Value($)'
'PCT.MBDDREP.MBDDREP.DDDUVA' AS 'Consumption,Value(%)'
COMPUTE CNSPCT/D12.2 = LAST CNSPCT + PCT.MBDDREP.MBDDREP.DDDUVA;
RANKED AS 'RANK' BY TOTAL HIGHEST 'MBDDREP.MBDDREP.DDDUVA' NOPRINT
BY 'MBDDREP.MBDDREP.DDAITX'

when i run the report its not showing the correct figure to be displayed in the CNSPCT column.

thanks again


WebFocus 762 AS400 / DB2
 
Posts: 34 | Location: Winnipeg, MB | Registered: January 23, 2008Report This Post
Virtuoso
posted Hide Post
Noel,

Your code is technically correct. The problem here is that you are trying to do two things in one pass of the data which are interferring with each other. The BY TOTAL HIGHEST sort is done last AFTER COMPUTEs. Therefore your running total is being calculated before the final sort which then rearranges the order. You need to create a HOLD file first with the aggregated values and then do another TABLE FILE using the HOLD file to get your final results.

Here's a working example with the CAR database.

TABLE FILE CAR
SUM AVE.RCOST AS 'AVERCOST'
SALES
WEIGHT
PCT.SALES AS 'PCTSALES'
BY COUNTRY
ON TABLE HOLD AS STEPONE
ON TABLE SET ASNAMES ON
END
-RUN
TABLE FILE STEPONE
PRINT AVERCOST
SALES
WEIGHT
PCTSALES
COMPUTE RUNTOT/D12.2=LAST RUNTOT + PCTSALES;
RANKED AS 'RANK' BY HIGHEST SALES
BY COUNTRY
END


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Silver Member
posted Hide Post
Guys,

Thanks a lot for the help. Your suggestions works


WebFocus 762 AS400 / DB2
 
Posts: 34 | Location: Winnipeg, MB | Registered: January 23, 2008Report This Post
Expert
posted Hide Post
Thanks Mickey: I had a brain freeze on this and your sample thawed it out...
-Doug
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders