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>
>>SET FILTER >>>>command,
>>GO TOP >>GO BOTTOM >>>>they can become sleep-inducing.
>>LOCATE
>>
>>