Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Eof() or found()
Message
De
18/12/2004 00:27:26
 
 
À
17/12/2004 20:53:38
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Divers
Thread ID:
00970039
Message ID:
00970278
Vues:
26
>>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform