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] can subtotal values be stored in a temporary variable?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] can subtotal values be stored in a temporary variable?
 Login/Join
 
Gold member
posted
Hello,

I need to use the subtotal values calculated in the subfoot for some further calculations.
Can the subtotal values be stored in a temporary variable to be used further.

Sample Code:
TABLE FILE CAR
PRINT 
     CAR.BODY.DEALER_COST
     CAR.BODY.RETAIL_COST
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR     
ON CAR.ORIGIN.COUNTRY SUBFOOT
"Subtotal DC: <ST.CAR.BODY.DEALER_COST "
ON CAR.ORIGIN.COUNTRY SUBFOOT
"Subtotal RC: <ST.CAR.BODY.RETAIL_COST "
ON TABLE NOTOTAL
END


I need the subtotal values of Dealer_cost and Retail_cost to calculate some other values, and display in the subfoot.

Thanks,

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


WebFOCUS 7.7.02Windows
Output Formats: Excel, HTML, PDF
 
Posts: 82 | Registered: February 23, 2011Report This Post
Gold member
posted Hide Post
To get the values into variables, you'd have to do a separate pass of the data first. Here's one way without variables.

 
TABLE FILE CAR
SUM CAR.BODY.DEALER_COST NOPRINT
    CAR.BODY.RETAIL_COST NOPRINT
COMPUTE DCTOT/I9C = CAR.BODY.DEALER_COST; NOPRINT
COMPUTE RCTOT/I9C = CAR.BODY.RETAIL_COST; NOPRINT
COMPUTE DIFF/I9C = C2-C1; NOPRINT
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
PRINT 
     CAR.BODY.DEALER_COST
     CAR.BODY.RETAIL_COST
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR     
ON CAR.ORIGIN.COUNTRY SUBFOOT
"Subtotal DC: <ST.CAR.BODY.DEALER_COST "
ON CAR.ORIGIN.COUNTRY SUBFOOT
"Subtotal RC: <ST.CAR.BODY.RETAIL_COST "
ON CAR.ORIGIN.COUNTRY SUBFOOT
"Subtotal Diff: <ST.DIFF "
ON TABLE NOTOTAL
END
 


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
 
Posts: 84 | Registered: December 13, 2005Report This Post
Gold member
posted Hide Post
Hello Microfich,

The code is working for addition and subtraction of C1 and C2.
I need ((C1/C2)*100).
When I put the formula in the code, I get a wrong answer.

TABLE FILE CAR
SUM CAR.BODY.DEALER_COST NOPRINT
    CAR.BODY.RETAIL_COST NOPRINT
COMPUTE DCTOT/D12.2 = CAR.BODY.DEALER_COST; NOPRINT
COMPUTE RCTOT/D12.2= CAR.BODY.RETAIL_COST; NOPRINT
COMPUTE DIFF/D12.2 = ((C2/C1)*100); NOPRINT
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
PRINT 
     CAR.BODY.DEALER_COST
     CAR.BODY.RETAIL_COST
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR     
ON CAR.ORIGIN.COUNTRY SUBFOOT
"Subtotal DC: <ST.CAR.BODY.DEALER_COST "
ON CAR.ORIGIN.COUNTRY SUBFOOT
"Subtotal RC: <ST.CAR.BODY.RETAIL_COST "
ON CAR.ORIGIN.COUNTRY SUBFOOT
"Subtotal Diff: <ST.DIFF "
ON TABLE NOTOTAL
END  


I do not understand why the formula is failing.

Thanks,


WebFOCUS 7.7.02Windows
Output Formats: Excel, HTML, PDF
 
Posts: 82 | Registered: February 23, 2011Report This Post
Virtuoso
posted Hide Post
I assume that If all of the subtotal values along with the ones you want to calculate happen at the same "break level" as you have 2 SUBFOOT on the same field (COUNTRY) then RECAP may come in handy:

TABLE FILE CAR
PRINT 
     CAR.BODY.DEALER_COST
     CAR.BODY.RETAIL_COST
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR     
ON CAR.ORIGIN.COUNTRY RECAP
ST_DC_RC/D20.2 = CAR.BODY.DEALER_COST + CAR.BODY.RETAIL_COST;
ON CAR.ORIGIN.COUNTRY SUBFOOT
"Subtotal DC: <ST.CAR.BODY.DEALER_COST "
ON CAR.ORIGIN.COUNTRY SUBFOOT
"Subtotal RC: <ST.CAR.BODY.RETAIL_COST "
ON CAR.ORIGIN.COUNTRY SUBFOOT
"Subtotal All: <ST_DC_RC" 
ON TABLE NOTOTAL
END


Or a bit simpler:

TABLE FILE CAR
PRINT 
     CAR.BODY.DEALER_COST
     CAR.BODY.RETAIL_COST
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR     
ON CAR.ORIGIN.COUNTRY RECAP
ST_DC_RC/D20.2 = CAR.BODY.DEALER_COST + CAR.BODY.RETAIL_COST;
ON CAR.ORIGIN.COUNTRY SUBFOOT
"Subtotal DC: <ST.CAR.BODY.DEALER_COST "
"Subtotal RC: <ST.CAR.BODY.RETAIL_COST "
"Subtotal All: <ST_DC_RC" 
ON TABLE NOTOTAL
END



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
Oh well, I didn't see your last message about (C2/C1) * 100 but that's a very easy one to make in the RECAP section ...

...
ON CAR.ORIGIN.COUNTRY RECAP
ST_DC_RC/D20.2 = (CAR.BODY.RETAIL_COST / CAR.BODY.DEALER_COST) * 100;
...



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Gold member
posted Hide Post
Thanks a lot njsden,

My issue is fixed.


WebFOCUS 7.7.02Windows
Output Formats: Excel, HTML, PDF
 
Posts: 82 | Registered: February 23, 2011Report This Post
Virtuoso
posted Hide Post
Great! You're welcome.

It would be helpful if you please edited the title of your original post prefixing it with [SOLVED] so we know it's done and that no extra support is needed on that one. Wink



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report 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] can subtotal values be stored in a temporary variable?

Copyright © 1996-2020 Information Builders