Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need idea for sort
Message
From
01/03/2010 00:42:27
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01451160
Message ID:
01451696
Views:
36
Hi Brandon,
thank you

Sort of,
If you add
INSERT INTO c_test (ctext) VALUES ('01.R')
INSERT INTO c_test (ctext) VALUES ('1.02.100')
INSERT INTO c_test (ctext) VALUES ('1.02.NA')
INSERT INTO c_test (ctext) VALUES ('01.R1')
INSERT INTO c_test (ctext) VALUES ('01.1R')
you see its problems. Anything starting with a digit should be basically a digit, and all words starting with alpha should come after the digit ones. (1.1 followed by 1.R)

Agnes
>Here's an ugly way
>
>CREATE CURSOR c_test (ctext C(40))
>INSERT INTO c_test (ctext) VALUES ('1.1')
>INSERT INTO c_test (ctext) VALUES ('1.02')
>INSERT INTO c_test (ctext) VALUES ('10.1')
>INSERT INTO c_test (ctext) VALUES ('01.3')
>INSERT INTO c_test (ctext) VALUES ('1.02.N')
>INSERT INTO c_test (ctext) VALUES ('1.02.N.R')
>INSERT INTO c_test (ctext) VALUES ('1.10.R')
>INSERT INTO c_test (ctext) VALUES ('1.10.R.1')
>INSERT INTO c_test (ctext) VALUES ('20DP')
>INSERT INTO c_test (ctext) VALUES ('20')
>INSERT INTO c_test (ctext) VALUES ('1.02.R')
>
>LOCAL lcSelect
>lcSelect=[SELECT ctext,]
>FOR lnX=1 TO 20
>	lcSelect=lcSelect+[PADL(ALLTRIM(STR(VAL(GETWORDNUM(ctext,]+ALLTRIM(STR(lnX))+[,'.')))),40,'0')+]+;
>		[PADR(CHRTRAN(GETWORDNUM(ctext,]+ALLTRIM(STR(lnX))+[,'.'),'0123456789',''),40) ]+;
>		[as s]+ALLTRIM(STR(lnX))+;
>		IIF(lnX<20,[,],[])
>endfor
>lcSelect=lcSelect+[ FROM c_test ORDER BY ]
>FOR lnX=1 TO 20
>	lcSelect=lcSelect+[s]+ALLTRIM(STR(lnX))+IIF(lnX<20,[,],[])
>ENDFOR
>
>&lcSelect
>
>
>
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform