Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Solved] Repeating Ranks
Go
New
Search
Notify
Tools
Reply
  
[Solved] Repeating Ranks
 Login/Join
 
Gold member
posted
I am sorting a sum field descending with limit set to 100 and rank turned on, my goal is to see the top(largest) 100 records.

I've run into a slight issue, if two or more records have the same number they will hold the same ranking place.

Example:

Rank Quantity
1-------18
2-------12
3-------9
---------9
4-------8
5-------2

I don't want 9 to be listed twice under rank 3, I want the first on to display 3 and the second 4.

Example:

Rank Quantity
1-------18
2-------12
3-------9
4-------9
5-------8

(Ignore the dashes, the spaces where getting deleted so I needed to put something there to keep everything spaced correctly)

I only have access to InfoAssist no code, so it must be done entirely in InfoAssist, Any Ideas? Thanks.

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


WebFocus 8.2, IA+, Windows 10, HTML
 
Posts: 54 | Location: UT | Registered: December 01, 2015Reply With QuoteReport This Post
Master
posted Hide Post
You have to make your own counter...

...or just put everything in a hold and then use a new table with RECORDLIMIT EQ 100

Good luck,
dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 669 | Location: Veghel, The Netherlands | Registered: February 16, 2010Reply With QuoteReport This Post
Gold member
posted Hide Post
Thank you for the reply! Could you elaborate on how to make a counter field, I see it in other places in the forum but it uses the word WITH in the define and InfoAssist is not having that.


WebFocus 8.2, IA+, Windows 10, HTML
 
Posts: 54 | Location: UT | Registered: December 01, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
Cimmerian,
A simplistic way is to use the LIST verb, here is an example(notice the 2nd SORT):

TABLE FILE GGSALES
LIST
DOLLARS
BUDUNITS
BUDDOLLARS
BY CATEGORY
BY HIGHEST DOLLARS NOPRINT
ON TABLE HOLD
END
-RUN
?FF HOLD
-RUN
TABLE FILE HOLD
PRINT *
BY CATEGORY NOPRINT
BY HIGHEST DOLLARS NOPRINT
WHERE LIST LE 100;
END
-EXIT

The other way is to set a counter and reset on the SORT column:

TABLE FILE GGSALES
PRINT
DOLLARS
BUDUNITS
BUDDOLLARS
COMPUTE CNTR/I4 = IF CATEGORY EQ LAST CATEGORY THEN CNTR + 1 ELSE 1;
BY CATEGORY
BY HIGHEST DOLLARS NOPRINT
ON TABLE HOLD
END
-RUN
?FF HOLD
-RUN
TABLE FILE HOLD
PRINT *
BY CATEGORY NOPRINT
BY HIGHEST DOLLARS NOPRINT
WHERE CNTR LE 100;
END
-EXIT

hth


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1956 | Location: Centennial, CO | Registered: January 31, 2006Reply With QuoteReport This Post
Master
posted Hide Post
So many ways to do things in WF. Here's another suggestion - a bit more abstruse: Introduce deliberate fractional inequalities in your values.

1) Create a new variable the same as your quantity

2) Use one of the random number subroutines available to create a very small fractional number.

3) Add that to your new variable, so a value like 10 would become 10.000001234 and another 10 would become 10.000005678

4) Run the fex with RANKED BY the new variable NOPRINT

TABLE FILE XYZ
PRINT QUANTITY
RANKED BY NewVariable NOPRINT
....
....
END


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Reply With QuoteReport This Post
Gold member
posted Hide Post
Thank you for all the replies! I appreciate all the help, I found George Patton's solution to be the most simple (I was overthinking this) and worked like a charm! Thanks again everybody, I will mark this as solved


WebFocus 8.2, IA+, Windows 10, HTML
 
Posts: 54 | Location: UT | Registered: December 01, 2015Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Solved] Repeating Ranks

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.