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     [SOVLED] Sort on sum field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOVLED] Sort on sum field
 Login/Join
 
Platinum Member
posted
This seems like it would be easy but I'm having problems. I have two by fields A and B and a sum field C. All I want to do is sort C by Desc so report should look like

A B C
GGG ffff 45
hhhh 41
vvv hhhh 67
dddd 45
ect..

code :

TABLE FILE SQLOUT
SUM 
     TRANSCOUNT
BY TOTAL HIGHEST TRANSCOUNT NOPRINT
BY EmpDivisionName
BY DNIS
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF 
ON TABLE COLUMN-TOTAL AS 'TOTAL' TRANSCOUNT
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *  


Any help would be much appreciated!

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


WebFocus 7.7.02 WinXP
 
Posts: 236 | Registered: May 12, 2006Report This Post
Virtuoso
posted Hide Post
Your post is a little confusing because the sample output you provide is not sorted by column C in descending order. But assuming that is what you want, here is an example using the CAR file that seems to work.

TABLE FILE CAR
 SUM
  COMPUTE PROFIT/D7 = RETAIL_COST - DEALER_COST ;
 BY TOTAL HIGHEST PROFIT NOPRINT
 BY COUNTRY
 BY CAR
 ON TABLE COLUMN-TOTAL AS 'TOTAL' PROFIT
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Platinum Member
posted Hide Post
Thanks, however this is not what I was looking for. My example did not come out right. The output needs to go in this order:
By field A (sorted)
By field B (sorted)
Sum field C (sorted desc)

Sum Field C needs to be sorted Desc. Your example sorts by profit first and does not keep the by fields together.

I'll try example again: Thanks!
 Division    DNIS     Sum
aaaaa       7778     780
            8889     741
			9999     600
bbbbb       7778     550
            8889     400
ccccc       7778     500 


WebFocus 7.7.02 WinXP
 
Posts: 236 | Registered: May 12, 2006Report This Post
Platinum Member
posted Hide Post
So, you want

BY DIVISION
BY PROFIT

correct?


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702
 
Posts: 127 | Location: San Antonio | Registered: May 29, 2009Report This Post
Platinum Member
posted Hide Post
Bonjour,
Something new occured while I was not at watch ?

IF TOTAL and WHERE TOTAL is possible since the point is just not to take into account the lines of the Internal Matrix (Agregated) that do not meet the where Total condition(s).

But, to ReSort the internal Matrix according to the result of the process of Agregation (BY TOTAL) surprises me.

Stackhanov and I used to Hold the result of the agregated data ( Not BY TOTAL Sorted yet)
And to Write the intended BY on the intermediate Hold File (BY at this point are de facto BY TOTAL of previous Step).
In Fact, Stackanoff and I, did that also about IF TOTAL when IF Total did not yet exist ...
(A time that youngsters just can't fancy ... "La Boheme" by Charles Aznavour)
Cordially
By the way, I fear that Stackhanoff is dead, and myself is not so brilliant as it used to be -if ever...
***
The Agregation can also be made at the SQL level with GROUP BY, and then at the Table File SQLOUT level a simple, Usual, BY
would sort on pre-agregated value


Focus Mainframe 7.6.11
Dev Studio 7.6.11 and !!!
PC Focus, Focus for OS/2, FFW Six, MSO
 
Posts: 134 | Registered: November 06, 2007Report This Post
Platinum Member
posted Hide Post
T...I want By Division then By DNIS. Profit is probably from the earlier example


WebFocus 7.7.02 WinXP
 
Posts: 236 | Registered: May 12, 2006Report This Post
Gold member
posted Hide Post
I am not sure if this is more what you are looking for JOE but is this more what you want the output to be like?

(Using Dan's Car example)
 TABLE FILE CAR
 SUM
  COMPUTE PROFIT/D7 = RETAIL_COST - DEALER_COST ; AS 'Sum'
 BY COUNTRY AS 'Division'
 BY TOTAL HIGHEST PROFIT NOPRINT
 BY CAR	AS 'DNIS'
 ON TABLE COLUMN-TOTAL AS 'TOTAL' PROFIT
END
 


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Report This Post
Platinum Member
posted Hide Post
Is DNIS a "summed" field.
To go back to your example at 8am.
IF A and B are both fields from the database and you are SUMMING C then there is only ONE c value for any A&B combination. A sort of ONE value always comes out in the same order!
SUM C BY A BY B


Brian Suter
VP WebFOCUS Product Development
 
Posts: 200 | Location: NYC | Registered: January 02, 2007Report This Post
Platinum Member
posted Hide Post
Thanks for all your help..I figured it out. I did the sum on a FOCUS hold and then did the grouping only at div level on next table.

Code below:

 ENGINE SQLMSS SET DEFAULT_CONNECTION IVB
SQL SQLMSS
EX ORBIT.dbo.CallTransDetail '&dte','&edte'
;
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS SQLOUT
END
TABLE FILE SQLOUT
SUM
     TRANSCOUNT
BY TOTAL HIGHEST TRANSCOUNT NOPRINT
BY EmpDivisionName
BY DNIS
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE HOLD AS DIV FORMAT FOCUS
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *

END
TABLE FILE DIV
PRINT
     DNIS AS 'Transfer,No.'
     TRANSCOUNT AS 'Call,Count'
BY EmpDivisionName AS 'Division'

ON EmpDivisionName SUBTOTAL AS '*TOTAL'
HEADING
"PNC Call Center "
"Call Transfer Detail Report"
"&dte<+0> through <+0>&edte"
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE SET EXPANDABLE ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE * 


WebFocus 7.7.02 WinXP
 
Posts: 236 | Registered: May 12, 2006Report 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     [SOVLED] Sort on sum field

Copyright © 1996-2020 Information Builders