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.
TABLE FILE CAR
SUM SALES NOPRINT
SUM SALES
COMPUTE PERCENT/D6.1 = (C2/C1)*100;
BY COUNTRY RECOMPUTE (OR SUMMARIZE)
IF COUNTRY EQ JAPAN OR 'W GERMANY'
END
I would expect:
COUNTRY SALES PERCENT
JAPAN 78030 46.9
*TOTAL JAPAN
78030 46.9
W GERMANY 88190 53.1
*TOTAL W GERMANY
88190 53.1
TOTAL
166220 100.0
What I get is:
COUNTRY SALES PERCENT
JAPAN 78030 46.9
*TOTAL JAPAN
78030 .0
W GERMANY 88190 53.1
*TOTAL W GERMANY
88190 53.1
TOTAL
166220 100.0
To overcome this I have to use:
TABLE FILE CAR
SUM SALES NOPRINT
SUM SALES
COMPUTE YSALES/I6=IF C1 EQ 0 THEN LAST YSALES ELSE C1; NOPRINT
COMPUTE PERCENT/D6.1 = (C2/YSALES)*100;
BY COUNTRY RECOMPUTE
IF COUNTRY EQ JAPAN OR 'W GERMANY'
END
Anyone any explanation please.
(Also tried on 7.6 and 4.3 with same result so do think I am out of it)
Alan. WF 7.705/8.007
Posts: 1451 | Location: Portugal | Registered: February 07, 2007
I wasn't so sure it was really the column notation, and TOT. only overcomes a bit of the problem as you said.
If you take the NOPRINT off SUM SALES and look at its value, it becomes zero after teh first record, then reverts back to it's original value on the last record.
Alan. WF 7.705/8.007
Posts: 1451 | Location: Portugal | Registered: February 07, 2007
This code gives the results you wanted, but not knowing the complete application, you may not be able to use subtotal TABLE FILE CAR SUM SALES NOPRINT SUM SALES COMPUTE PERCENT/D6.1 = (C2/C1)*100; BY COUNTRY IF COUNTRY EQ JAPAN OR 'W GERMANY' ON COUNTRY SUBTOTAL END
Leah
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004
I would also open a tech support case with IBI with the code you posted. This looks like a bug. If not, at least Art or Noreen may be able to explain why you got a 0 on the first RECOMPUTE and not the other.
Thanks!
Mickey
FOCUS/WebFOCUS 1990 - 2011
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003
I would agree that it is a likely "feature" is as much that the SUBTOTAL (as per Leah) functions exactly as you would expect but the RECOMPUTE and SUMMARIZE do not.
Let us know what comes of it should you decide to progress.
It is also worth noting the results when you remove the selection clause. The only correct RECOMPUTE value is the last one - no wonder you began questioning ....
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Please try the following suggestion from internal FOCUS wizards:
DEFINE FILE CAR
CTR/I5 WITH COUNTRY= 1;
END
TABLE FILE CAR
SUM
TOT.SALES NOPRINT
CTR NOPRINT
SALES
COMPUTE PERCENT/D6.1 = (C3/(C1/C2))*100;
BY COUNTRY
ON COUNTRY RECOMPUTE
IF COUNTRY EQ JAPAN OR 'W GERMANY'
END
The issue is, using TOT.SALES (or SALES WITHIN TABLE), you get the TOTAL for each COUNTRY. On the grand 'RECOMPUTE', you have 'n' times the value, where 'n' is the number of COUNTRYs. By dividing by the DEFINEd field CTR, it's dividing by 1 for each country, and by 'n' on the grand RECOMPUTE (that's why it needed to be a DEFINE, not a COMPUTE).
If you use the multi-verb approach, as originally given, the grand total of SALES isn't available until the end; you can't use it at an 'ON COUNTRY' action, as it's not available at that level, only on the TABLE level (which is why the last calculation is correct).
Hope this helps.
Cheers,
Kerry
Kerry Zhan Focal Point Moderator Information Builders, Inc.
Posts: 1948 | Location: New York | Registered: November 16, 2004
Using the 'global' value at a sort field break, gives a ZERO result, as the value is not available at that level, but only at the GLOBAL level, which is why only the LAST calculation is correct.
Here's how to do it:
DEFINE FILE CAR
CTR/I5 WITH COUNTRY= 1;
END
TABLE FILE CAR
SUM
TOT.SALES NOPRINT
CTR NOPRINT
SALES
COMPUTE PERCENT/D6.1 = (C3/(C1/C2))*100;
BY COUNTRY
ON COUNTRY RECOMPUTE
IF COUNTRY EQ JAPAN OR 'W GERMANY'
END
It gets the TOTAL at the detail level, and uses the CTR field to avoid having multiple instances. (Message End. Thank you Raoul.)
Which makes sense, I suppose. Anyway it does work, just make sure you have CNTR else the RECOMPUTE subtotal will be wrong.
Alan. WF 7.705/8.007
Posts: 1451 | Location: Portugal | Registered: February 07, 2007