Focal Point
[SOLVED] Trying to rank cars in country based on user input...

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/329103213

December 08, 2009, 03:16 PM
Tomsweb
[SOLVED] Trying to rank cars in country based on user input...
As a prototype, I am trying to rank cars in country based on user input.
If I start with this...
quote:
TABLE FILE CAR
PRINT
CAR
BY COUNTRY
ON TABLE
END


Of course, my ouptut will look like:
England jaguar
jenson
triumph
France peugeot
Italy alfa romeo
maserati
Japan datsun
toyota
W Germany audi
bmw

What I am trying to do is reorder the order of the countries so the one
inputted by the user would show up first, with the rest to follow after.

If the user inputted Italy, I like to see this order:

Italy alfa romeo
maserati
England jaguar
jenson
triumph
France peugeot
Japan datsun
toyota
W Germany audi
bmw

I am stuck...Can anyone help me make some progress? Roll Eyes

Thanks!

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


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
December 08, 2009, 03:31 PM
Francis Mariani
-SET &CTRY = 'ITALY';

DEFINE FILE CAR
COUNTRYSORT/A11 = IF COUNTRY EQ '&CTRY' THEN '1' | COUNTRY ELSE '2' | COUNTRY;
END
TABLE FILE CAR
PRINT
CAR
BY COUNTRYSORT NOPRINT
BY COUNTRY
END



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
December 08, 2009, 03:43 PM
Waz
As this is user input, I would also have matched the case of the test.

-SET &CTRY = UPCASE(&CTRY.LENGTH,&CTRY,'A&CTRY.LENGTH');

COUNTRYSORT/I1 = IF UPCASE(10,COUNTRY,'A10') EQ '&CTRY' THEN 1 ELSE 2 ;



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

December 08, 2009, 03:43 PM
Tomsweb
Thanks Francis


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
December 08, 2009, 04:04 PM
Francis Mariani
Sure.

-SET &CTRY = 'itAly';

-SET &CTRY = UPCASE(&CTRY.LENGTH, &CTRY, 'A&CTRY.LENGTH');

DEFINE FILE CAR
COUNTRYSORT/A1 = IF COUNTRY EQ '&CTRY' THEN '1'  ELSE '2';
END
TABLE FILE CAR
PRINT
CAR
BY COUNTRYSORT NOPRINT
BY COUNTRY
END



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server