Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Recno funny
Message
De
30/07/2007 12:56:55
 
 
À
30/07/2007 10:41:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Vista
Divers
Thread ID:
01244570
Message ID:
01244643
Vues:
14
>A RECNO() funny - If you have a table and you do a locate (or skip etc) and end up at EOF() then RECNO() returns 1 more than the actual number of records. Does everyone but me know about this :)

A different funny happens with BOF(). When you are at BOF() there is no phantom record. You are actually pointed to the first record in the table -- using the active index.
CREATE CURSOR temp (f1 c(10))
INSERT INTO temp VALUES ("bbb")
INSERT INTO temp VALUES ("ccc")
INSERT INTO temp VALUES ("aaa")
INDEX ON f1 TAG f1
GO top
SKIP -1
? BOF() -------------------------->  .T.
? RECNO() ------------------------>  3
REPLACE f1 WITH "xxx"
? f1 -----------------------------> "xxx"
? BOF() --------------------------> .F.
? RECNO() ------------------------> 3
Granted I have almost never worked with BOF() but it took me a while to discover why
LOCATE FOR somecondtion
SKIP -1
IF BOF()  && Am I at top of file -- yup
  SKIP    && thought I was going to top of file but was actually going to 2nd record
ENDIF
didn't work properly
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform