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.
-* FOCUS code: -* File ranks.fex -DEFAULT &HIGHLOW = 'HIGHEST'; -DEFAULT &NUMRANK = 2; TABLE FILE CAR SUM SALES BY COUNTRY BY &HIGHLOW &NUMRANK TOTAL SALES BY MODEL END
HTML form to invoke the ranks procedure:
This message has been edited. Last edited by: <Mabel>,
Speaking of RANKing, I have a tangential-related question. When you have identical sort field values, the RANK is the same, as expected. But when the sort field value changes, the RANK only increments by 1 instead of the actual positional value.
I've encountered that same problem... you end up on occasion with 14 items on what you thought was your Top 10 list.
The way I got around it is adding in an additional field called RANK.
e.g
-* Maxlimit can be anything you want it to be -* and can be passed as a parameter ... -SET &MAXLIMIT = 10; TABLE FILE CAR PRINT COMPUTE RANK/I3 = RANK + 1; SORTFIELD FIELD1 FIELD2 BY HIGHEST SORTFIELD NOPRINT WHERE TOTAL RANK LE &MAXLIMIT END So you get the same table format (columns in the same place) with a ranking system that increments every line.
LeoThis message has been edited. Last edited by: <Mabel>,
Sorry, I misread the post and just gave you the listing. For the Ranking purpose, the code I have is:
-* Extract the information you want to Rank TABLE FILE TNAME PRINT FIELD1 FIELD2 BY HIGHEST 10 SORTFIELD ON TABLE HOLD END
-* Define the proper ranking DEFINE FILE HOLD TEMP1/I3 = IF SORTFIELD EQ LAST SORTFIELD THEN 0 ELSE 1; TEMP2/I3 = IF TEMP1 EQ 0 THEN LAST TEMP2 + 1 ELSE 1; TEMP3/I3 = IF TEMP1 EQ 1 THEN TEMP3 + LAST TEMP2 ELSE LAST TEMP3; RANK/I3 = TEMP3 + 1; END
-* Display the information as you want. -* whether you want the ranking to display a value -*for each row or only when the value changes
TABLE FILE HOLD PRINT RANK SORTFIELD FIELD1 FIELD2 BY HIGHEST SORTFIELD NOPRINT END -* OR TABLE FILE HOLD PRINT SORTFIELD FIELD1 FIELD2 BY RANK END This is what I have currently working... might not be the prettiest solution but I know it works here.
LeoThis message has been edited. Last edited by: <Mabel>,
So does something like this not accomplish the desired output? If there are values that are a "tie" they all fall under the same rank number as I understand it.
TABLE FILE CAR SUM SALES RANKED AS 'RANK' BY TOTAL HIGHEST 3 SALES NOPRINT BY CAR ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE SET ONLINE-FMT HTML
The following value will end up being the next number in the sequence instead of the true value. This also causes problems when your trying to display something like the Top 5 sales or something and there are ties. As you can see if the RANK is just used, you'll end up with 6 values that are ranked 5 and under.
The code I provided takes into consideration that if there is a tie, that the following number should receive what it actually is instead of the following number after the tie.