Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Complex index
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01125366
Message ID:
01125386
Views:
14
Tracy -

The line
index on str(datakey,5) + str(seq * evl(sortorder,1),5) to temp
did not work. But you gave me an idea.
The line
index on str(datakey,5) + str(iif(sortorder<0,900-seq,seq),5) to temp
does work. This of course assumes that seq will never be larger than 900 which is a safe assumption in this case.

Thanks

- Don

>Might this work?
>str(datakey,20)+str(seq * evl(sortorder,1),20)
>
>>I'm not sure this is possible but, I would like to build an index statement using 3 fields, datakey, seq, and sortorder. All 3 fields are numeric. The first sort would be on datakey. The second sort would be on seq ascending except when sortorder value is -1, in which case the second sort would be descending. So the output would look like this:
>>
>>datakey seq sortorder
>>1 1 0
>>1 2 0
>>1 3 0
>>1 4 0
>>2 4 -1
>>2 3 -1
>>2 2 -1
>>2 1 -1
>>3 4 -1
>>3 3 -1
>>3 2 -1
>>3 1 -1
>>4 1 0
>>4 2 0
>>4 3 0
>>
>>
>>I could use a index on statement or an sql order by statement, whichever is easier.
>>If I can't do it with either of these I'll have to build a couple of complex loops with a new data field. (I guess)
>>
>>Thanks for any suggestions.
Previous
Reply
Map
View

Click here to load this message in the networking platform