Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Nasty index, any better ideas?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00817470
Message ID:
00817503
Views:
18
Maybe this really isn't an answer to the question but if I was given this data the first thing I'd do is create a "shadow" field to hold some algorithmically transformed version of this mess to put it a a logically indexable form. No?


>I have a data field of mixed alphanumeric that needs a specific sort order. I think this is enough points to illustrate. They are either all integer data points, or begin with an alpha and the rest is numeric. Example:
>
>Unordered data: B16,16,C2,5,123,2,C21,D86,278,27,2796,B1,C22
>
>Ordered data: 2,5,16,27,123,278,2796,B1,B16,C2,C21,C22,D86
>
>Here's my quickly devised ordering method, call the field CatNumber (yeah, I know, yuck, this is not very elegant):
>
>INDEX ON IIF(ISALPHA(SUBSTR(CatNumber,1,1)),;
>1000*ASC(SUBSTR(CatNumber,1,1))+VAL(SUBSTR(CatNumber,2)),;
>VAL(SUBSTR(CatNumber,1))) TAG CatNumber
>
>The "1000" multiplier is big enough for all possible data points, BTW. It works, if a bit ugly, so why the problem? I'm doing a hobby-article for not very deep coders - people that have only MS Access available, IOW. And I don't find Access supporting the above solution. Anyone see any ideas that are simpler, and might work in Access? Just a "simpler vfp index" would be a good start for the Access stage...
>
>(Note: I'm avoiding any possible less-standard vfp functions like LEFT, also, as part of this project.)


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform