Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set Filter and GO Bottom
Message
From
07/05/2004 08:33:32
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
07/05/2004 03:16:34
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00901656
Message ID:
00901887
Views:
24
Hi Walter

I wrote something very much like that for a FoxPro Advisor article in '97.

>Hi Fabio,
>
>Appart from the fact I always try to avoid working with tables in this manner (e.g. Using views), I can only think of the following.
>
>WARNING: Code not tested...
>
>
SELECT YourAlias
>
>DO CASE
>   CASE EMPTY(FILTER()) AND SET("DELETED") = "ON"
>       ** No filter and SET DELETED has been set off, so GO BOTTOM should be the fastest
>       GO BOTTOM
>
>   CASE TAGCOUNT() = 0
>       ** No index to use for optimization, GO BOTTOM is the only thing you've got.
>       GO BOTTOM
>
>   CASE EMPTY(ORDER()) AND SET("DELETED")="ON" AND TAGNO("DELTAG")
>       ** Assuming deltag is an INDEX ON NOT DELETED() TAG DELTAG
>       ** This tag is also handy for locating deleted records for recylcing
>       ** Note the NOT operator that prevents it beeing rushmore optimizable,
>       ** because of possible performance problems in rushmore when SET DELETED = ON
>       SEEK .T. ORDER TAG Deltag DESCENDING
>
>   CASE EMPTY(ORDER()) AND !EOF()
>       ** Not at EOF(), calculate the maximum recordnumber for the rest of the table
>       CALCULATE REST MAX(RECNO()) TO nRec  && Hoping rushmore can kick in
>       LOCATE RECORD nRec
>
>   CASE EMPTY(ORDER())
>       ** At EOF(), start calculate at top of table
>       CALCULATE MAX(RECNO()) TO nRec && Hoping rushmore can kick in
>       LOCATE RECORD nRec
>
>   CASE DESCENDING()
>       ** switch index order and do a LOCATE.
>       SET ORDER TO (ORDER()) ASC
>       LOCATE  && Hoping rushmore can kick in
>       SET ORDER TO (ORDER()) DESC
>
>   OTHERWISE
>       ** switch index order and do a LOCATE.
>       SET ORDER TO TAG (ORDER()) DESC
>       LOCATE && Hoping rushmore can kick in
>       SET ORDER TO TAG (ORDER()) ASC
>ENDCASE
>
>Of course there are some other mechanisms thinkable depending on your situation.
>IF you already know at forehand that the filter won't be rushmore optimizable at all, then it is useless to use anything else than GO BOTTOM
>
>Walter,
>
>
>>If i use a
>>
>>SET FILTER
>>
>>command,
>>then the commnad
>>
>>GO TOP
>>GO BOTTOM
>>
>>they can become sleep-inducing.
>>
>>For GO TOP, a partial solution exist, use:
>>
>>LOCATE
>>
>>
>>but for GO BOTTOM ?
>>
>>Thanks.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform