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     summarize/recompute giving weird result.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
summarize/recompute giving weird result.
 Login/Join
 
Virtuoso
posted
Hope I am not totally gone this morning.

From this simple code:
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, 2007Report This Post
Expert
posted Hide Post
Alan,

Seems to be a problem with using column notation. If you use -
TABLE FILE CAR
SUM SALES NOPRINT
SUM SALES
COMPUTE PERCENT/D6.1 = (C2/TOT.SALES)*100;
BY COUNTRY RECOMPUTE
IF COUNTRY EQ 'JAPAN' OR 'W GERMANY'
END

the result is as you would expect without the IF ... THEN ... ELSE ...;

T

Except that the total percentage isn't correct Red Face



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, 2004Report This Post
Virtuoso
posted Hide Post
Tony,

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. Confused


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
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, 2004Report This Post
Virtuoso
posted Hide Post
Alan,

Try using the PCT. prefix operator. I assume you are creating a COMPUTE field so that you get more precision in the percent value.

Try the following:

DEFINE FILE CAR
NEWSALES/D6.1=SALES;
END

TABLE FILE CAR
SUM SALES PCT.NEWSALES AS '% Sales'
BY COUNTRY RECOMPUTE
IF COUNTRY EQ JAPAN OR 'W GERMANY'
END


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Virtuoso
posted Hide Post
Thanks guys, but the issues are more complex, I was just showing the problem in a simple way.

Calculation is needed using both parts of the multi verb request and a recompute.

It is really a question as to whether I should expect this to work, is it a feature, or worse.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
Alan,

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, 2003Report This Post
Expert
posted Hide Post
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, 2004Report This Post
Virtuoso
posted Hide Post
Thanks Mickey and Tony,

I like to check I am sane before opening a case, but will do so and give results back here.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
Hi Alan and all,

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. Big Grin

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
 
Posts: 1948 | Location: New York | Registered: November 16, 2004Report This Post
Virtuoso
posted Hide Post
Oooh! Heavy.

From IB:

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, 2007Report 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     summarize/recompute giving weird result.

Copyright © 1996-2020 Information Builders