Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can I SEEK for nearest matched record in CURSOR?
Message
From
29/07/1999 14:48:48
 
 
To
29/07/1999 13:45:39
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00247560
Message ID:
00247863
Views:
22
As the others mentioned, I would do the SQL SELECT to populate the cursor, then index the cursor as needed using INDEX ON. If you need more than one index, do:

USE DBF( "MyTempCursor" ) IN 0 AGAIN ALIAS MyCursor
USE IN SELECT( "MyTempCursor" )
SELECT MyCursor
INDEX ON ...
INDEX ON ...

to get an editable cursor that can have more than one index.
You can SET NEAR/EXACT as needed to get the appropriate behavior. When you close the cursor, the underlying table and indexes will go away.

Bill

>Thanks to Bill, Bruce, Walter, Vinod and Ed.
>
>I think Bruce and Ed got my situation. I'm using the SQL Select to make some searches and output them to a form. So I created a temporary cursor for the ControlSource on the form's control. And I did all the things well when the user enters a valid record to search for. Just that, if the user enters an invalid record, I need to Set Near On to get the nearest matched record. But Set Near On will require either Seek or Find where I need to create a temporary index files.
>
>Maybe the solution is I just create an index tag using Index On.. and then delete the index files after closing the form. Got a better way?
>Gan
>
>>>All,
>>>
>>>I have a SQL Select for putting all my records in a cursor, and I need to do some search in the cursor.
>>>
>>>I''m be able to use LOCATE to look for a certain record but couldn't use SEEK or FIND because both of them need an index tag. I need to search for the nearest matched record in the cursor in case LOCATE fails.
>>>
>>>Any solution for this?
>>>
>>>Thanks.
>>>Gan
>>
>>In addition to what the others have said, you might want to look at SET NEAR and SET EXACT for this situation.
>>
>>Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Previous
Reply
Map
View

Click here to load this message in the networking platform