Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GOTO on Filtered data
Message
De
20/11/2004 21:41:08
Ken Dibble
Southern Tier Independence Center
Binghamton, New York, États-Unis
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00962533
Message ID:
00963279
Vues:
7
>
>>>The GOTO < Record # > command pays no attention to SET FILETER or SET DELETE ON.
>>
>>That's not documented in the Help for the GOTO topic, BTW.

>
>Not directly. Help says that in the form GO nRecordNumber GO command moves a record pointer moves to the specified physical record number. It doesn't say that it can be affected buy anything and it's correct. On other hand, it failed to mention that GO TOP and GO BOTTOM do affected by SET FILETER or SET DELETE ON.

Thanks very much for continuing to explain this for me.

I see what you're saying here. And I didn't even catch the GO TOP/BOTTOM issue. See my reply to Jim regarding the Help for SET FILTER, though.

[snip]

>I should say "In most cases it does issue an implicit LOCATE" but I didn't remeber that there were special cases at the time when I posted reply.
>The one of such special cases is when record pointer is positioned on the last record in the table and this record doesn't satisfy filter criteria. In this case VFP checks if previous records satisfies the filter critire. If it does than record pointer is moved to it otherwise LOCATE is issued.
IF RECNO() = RECCOUNT() AND NOT EVAL(< filter condition >)
>	SKIP -1
>ENDIF
>IF NOT EVAL(< filter condition >)	
>	LOCATE
>ENDIF	
>I'm not sure if there are any other such special conditions though.

Actually, try this:
RELEASE ALL
CLEAR ALL
CLEAR

LOCAL x, nRec

CREATE CURSOR foo ( ;
     IntField I, ;
     CharField c(10) )

FOR x = 1 TO 10     
     INSERT INTO foo (IntField, CharField) ;
     VALUES (x,TRANSFORM(x))
ENDFOR

GO 10

nRec = RECNO()

? nRec  && 10

? CharField  && "10"

SET FILTER TO NOT ALLTRIM(CharField) == "9" AND NOT ALLTRIM(CharField) == "10"

LOCATE

BROWSE  && The records that contain "9" and "10" aren't visible, pointer is on record 1

? CharField  && "1"

GO nRec 

? CharField  && "10"

BROWSE  && Pointer on record 8

? CharField && "8"
I interpret your explanation to mean BROWSE skips back just once, and if the record it lands on doesn't match the filter, LOCATE is issued and the pointer should be on the first record, which in my example is record 1.

It doesn't look like that's happening. I think what's really going on is closer to the code I posted before.

Not that I consider this a critical issue, nor am I just trying to get under your skin. <g> My real issue at this point is the poor documentation of SET FILTER and GOTO. But I'm enjoying this just the same.

Ken
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform