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.
I have the first 3 columns in by data structure and would like to be able to rank and then store the last 2 columns and then be able to report on that.
Does anyone have any thoughts?
Posts: 19 | Location: Springfield, MA | Registered: May 04, 2004
I would RANK Rtns and HOLD, RANK MV% and HOLD, MATCH the two HOLD files.
SET ASNAMES = ON TABLE FILE CAR SUM SALES DEALER_COST BY COUNTRY ON TABLE HOLD AS HOLD0 END TABLE FILE HOLD0 SUM COUNTRY RANKED BY SALES ON TABLE HOLD AS HOLD01 END ?FF HOLD01 TABLE FILE HOLD0 SUM COUNTRY RANKED BY DEALER_COST ON TABLE HOLD AS HOLD02 END ?FF HOLD02 MATCH FILE HOLD01 PRINT SALES RANK AS 'RANK1' BY COUNTRY RUN FILE HOLD02 PRINT DEALER_COST RANK AS 'RANK2' BY COUNTRY AFTER MATCH HOLD AS HOLD03 OLD-OR-NEW END TABLE FILE HOLD03 PRINT * END
Thanks for the thoughts. I haven't had time to get back to this. Seems like that code should work. Trouble could be is there are probably 20 fields or more that need to be ranked so it could be quite a bit of hold files. Will be testing in the coming months and will post any additional questions/thoughts as I go.
Ryan
Posts: 19 | Location: Springfield, MA | Registered: May 04, 2004
If you are accepting the various fields to be ranked via an HTML form and you have a mulit select (or even if you mimic it) you could use the following code to effect your variable ranking requirement -
-SET &ECHO='ALL'; SET HOLDLIST = PRINTONLY -DEFAULT &Ranking = RETAIL_COST -DEFAULT &Ranking0 = 4 -DEFAULT &Ranking1 = RETAIL_COST -DEFAULT &Ranking2 = DEALER_COST -DEFAULT &Ranking3 = SALES -DEFAULT &Ranking4 = SEATS TABLE FILE CAR SUM -SET &Cnt = 1; -REPEAT :Loop0 &Ranking0 TIMES; &Ranking&Cnt.EVAL/D15 -SET &Cnt = &Cnt + 1; -:Loop0 BY MODEL BY BODYTYPE ON TABLE HOLD AS MYDATA END -RUN
-SET &Cnt = 1; -REPEAT :Loop1 &Ranking0 TIMES; TABLE FILE MYDATA SUM &Ranking&Cnt.EVAL/D15 RANKED BY HIGHEST &Ranking&Cnt.EVAL BY MODEL BY BODYTYPE ON TABLE HOLD AS HOLD0&Cnt.EVAL END -SET &Cnt = &Cnt + 1; -:Loop1
-SET &Cnt = 1; MATCH FILE HOLD0&Cnt.EVAL PRINT &Ranking&Cnt.EVAL RANK AS 'RANK&Cnt.EVAL' BY MODEL BY BODYTYPE RUN -SET &ThisLoop = &Ranking0 - 2; -SET &Cnt = &Cnt + 1; -REPEAT :Loop2 &ThisLoop TIMES; FILE HOLD0&Cnt.EVAL PRINT &Ranking&Cnt.EVAL RANK AS 'RANK&Cnt.EVAL' BY MODEL BY BODYTYPE RUN -SET &Cnt = &Cnt + 1; -:Loop2 FILE HOLD0&Cnt.EVAL PRINT &Ranking&Cnt.EVAL RANK AS 'RANK&Cnt.EVAL' BY MODEL BY BODYTYPE AFTER MATCH HOLD AS FINALFILE OLD-OR-NEW END TABLE FILE FINALFILE PRINT * END
You can change the DEFAULT variables to any number you want and the rest of the code remains the same. You just have to be careful that the summation of the data fields are at the same level to obtain the correct results.
TThis message has been edited. Last edited by: <Maryellen>,
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
If you want to resort the report by clicking on the ranking column then add a DEFAULT for &SORT to RANK1 and replace the final TABLE request with this -
TABLE FILE FINALFILE PRINT * BY &SORT NOPRINT ON TABLE SET STYLE * -SET &Cnt = 1; -REPEAT :Loop3 &Ranking0 TIMES; TYPE=TITLE, COLUMN=RANK&Cnt.EVAL, FOCEXEC=dynam_rank(SORT='RANK&Cnt.EVAL'), $ -SET &Cnt = &Cnt + 1; -:Loop3 END
and remember to evaluate the amount of data that you will handle each pass so that your DBAs don't moan!!!! This message has been edited. Last edited by: <Maryellen>,
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