Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Nasty index, any better ideas?
Message
From
06/08/2003 18:34:29
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00817470
Message ID:
00817498
Views:
24
>>I don't have VFP at hand to test the following, so you might try it.
>>
>>
>>index on str(val(CatNumber)) + CatNumber tag CatNumber
>>
>>
>>Reasoning:
>>
>>val() should give 0 for codes that start with a letter. In this case, the second part should resolve ties.
>
>Hi Hilmar, and thanks for the reply. I did try that along the way to my messy solution, but this puts all the alphas at the top (the numerics are ordered right, of course).

Ah, I see. If you want numbers first. How about adding an iif(). I don't see any problem with testing the first character with left(). Apply this to the first part of the expression.

str(val(iif(between(upper(left(CatNumber),1), "A", "Z"), 999999);
+ CatNumber

Well, this is getting about as messy as your original proposal, in the message that originated this thread.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform