>>
In any case you would obtain an expression that locate could benefit the index.
>
>Cetin, can you explain the above comment, I don't understand, sorry.
>
>Mark
Mark,
Suppose you have fields like :
myId i
myDate d
myCheckNumber i
myStatus l
myChar c(10)
and index tags with keys :
myId - myId
myDate - myDate
myCheckNumber - myCheckNumber
myStatus - myStatus
myChar - myChar
myMain - padl(myId,5,"0")+ ;
dtos(myMain)+;
padl(myCheckNumber,5,"0")+;
iif(myStatus,"1","0")+;
myChar
In this case you could say :
locate for myId = 3 and myCheckNumber = 5 and between(myDate, dDate1, dDate2)
and it would benefit indexes. For these type of locates there is no simple seek replacement. Now if you wanted to search for a full PK and one the single tags is missing then you would build an expression to benefit rushmore :
lcSearchExpr = padl(1,5,"0")+ ;
dtos({^2000/1/1})+;
padl(5,5,"0")+;
"1"+myChar
or a partail one :
lcSearchExpr = padl(1,5,"0")+ dtos({^2000/1/1})
both would use the myMain tag. It would also be affected by "set deleted" and if you have indexes on deleted() and/or myMain is filtered (filtering PK is arguable - and I don't say you must or mustn't). In any case a locate optimization should check the indexes it can use and it consumes time theoritically. For seek, since you're comparing both in speed I suppose you accept that you already have a suitable tag to use (here myMain for full or sample partial PK) :
seek(lcSearch, "myTable", "myMain")
would directly select and use that tag. It also has an advantage that you don't need to change workarea or current tag :)
Cetin