Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Eof() or found()
Message
From
18/12/2004 00:27:26
 
 
To
17/12/2004 20:53:38
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00970039
Message ID:
00970278
Views:
24
>>>I would agree with most of the others here and say that FOUND() is the better choice. >SET NEAR ON can break the use of EOF() whereas FOUND() will always be accurate.
>>
>>Jim
>>Do you mean to say that if "Set Near" is set ON and if you are trying to seek partial variable, "If not eof()" will be .T. but found() will be .F. ???
>>Shafid
>
>The whole idea of SET NEAR is that if an exact match is not found, the closest matching record will be selected. Therefore, EOF will NOT be true.

Hi Hilmar,

the closest concept it is a metric concept.

The documentation
Positions the record pointer on the closest matching record if a record
search using FIND or SEEK is unsuccessful. With this setting, RECNO( ) 
returns the record number of the closest matching record, FOUND( ) returns 
false (.F.), and EOF( ) returns false (.F.). 
it is mistaken,

with SET NEAR ON, vfp :
Positions the record pointer on the NEXT ORDERED record if a record search 
using FIND or SEEK is unsuccessful. With this setting, RECNO( ) returns the 
record number of the NEXT ORDERED record, FOUND( ) returns false (.F.), and 
EOF( ) returns false (.F.). 
clear
CREATE CURSOR neardata (f1 i)
INSERT INTO neardata VALUES (7)
INSERT INTO neardata VALUES (3)
INSERT INTO neardata VALUES (10)
INDEX ON f1 TAG t1
SET NEAR ON
SEEK 8
? f1,FOUND(),EOF() && the closest matching record it is f1=7
SEEK 9
? f1,FOUND(),EOF() && the closest matching record it is f1=10
SEEK 9 ORDER t1 DESCENDING
? f1,FOUND(),EOF() && the closest matching record it is f1=10
SEEK 11
? f1,FOUND(),EOF() && the closest matching record it is f1=10
Previous
Reply
Map
View

Click here to load this message in the networking platform