Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a compound index with a descending portion
Message
From
28/09/2005 15:47:24
 
 
To
28/09/2005 15:31:25
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01053896
Message ID:
01054185
Views:
55
>>>>>I have an application that needs a compound index built. The fields are all string fields, but the user would like the second field to be in descending order. Is there a good way to do this in VFP?
>>>>>
>>>>>TIA
>>>>
>>>>The best of the simples way is to use SYS(15), but it don't support 0h0
>>>>
>>>>INDEX ON FIELD1+sys(15,0HFFFEFD.....,field2) tag ...
>>>>
>>>
>>>The problem with the SYS command is the phrase "Kept for Backward compatiblity" in the help file. This makes me wonder if the command will still be around from version to version and supported. Thanks for the response.
>>
>>1. This is a false problem on the last version.
>>2. It works. "Kept for Backward compatiblity" it doesn't have some meaning for me.
>
>Sys(15) is there since FoxPlus, and the only reason it's marked as "backward compatible" is that chrtran() is more flexible and yet can do the same thing. I don't see sys(15) ever going away, specially when that was the recommended way to get national collating sequences in the early versions. There was european.mem file distributed with Fox, FP and VFP until some version, which contained a variable to be used with sys(15) to achieve collating sequence General. My bet is it stays.

sure, but a 18x faster
it is not to throw in the garbage,
and for an index key ....
CLEAR
s0=0h
s1=0H
FOR k=1 TO 254
	s0=m.s0+CHR(k)
	s1=m.s1+CHR(K+1) && shift 1 up
next

* burn
FOR K=1 TO 10000000
NEXT

s=REPLICATE(m.s0,10000)

t1=SECONDS()
		x1=SYS(15,m.s1,m.s)
? "sys",SECONDS()-t1

t1=SECONDS()
	x2=CHRTRAN(m.s,m.s0,m.s1)
? "chrtran",SECONDS()-t1

* raplay
t1=SECONDS()
		x1=SYS(15,m.s1,m.s)
? "sys",SECONDS()-t1

t1=SECONDS()
	x2=CHRTRAN(m.s,m.s0,m.s1)
? "chrtran",SECONDS()-t1

? "equal",x1==x2
Previous
Reply
Map
View

Click here to load this message in the networking platform