Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GOTO on Filtered data
Message
De
18/11/2004 22:15:52
Ken Dibble
Southern Tier Independence Center
Binghamton, New York, États-Unis
 
 
À
18/11/2004 07:45:51
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:
00962881
Vues:
11
Okay.

I was going to suggest that you *can't* get back to that record because under your filter, it's no longer visible. It doesn't exist in this view of the table; that's why it's "out of range". So I started messing around with some simple demo code, and I discovered 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 2

nRec = RECNO()

? nRec  && 2

? CharField  && "2"

SET FILTER TO NOT ALLTRIM(CharField) == "2"

LOCATE

BROWSE  && The record that contains "2" isn't visible, pointer is on record 1

? CharField  && "1"

GO nRec 

* With this commented out, the next line returns "2", which should be
* impossible, because that record isn't visible; it's excluded by the filter.
* If this line runs, the browse window shows the record pointer on the second
* record, where CharField = "3", and the next line returns "3", which is what
* should happen with or without the BROWSE.
*BROWSE

? CharField 
Can anyone explain this?

TIA.

Ken

>Hi Fabio
>
>I kinda figured that was the case - that, at EOF() there's an extra "mythical" rec no added on. Thanks for the solution. The trouble is, as with Sergey's, in display mode I have a rec no. As soon as I toggle to hide (and they're ALL hidden), then I get this bad VFP design extra rec no, then toggle back, I haven't got my original rec no to return to, which is the problem.
>
>I guess I'll have to store the recno of each table in a form property that I continually update every time I move in a grid. Then I can always go back to it as I know it exists.
>
>PS As I explained to Sergey, I'm all for using Locate in stead of go top - I just changed it in case that was the problem.
>
>molti grazzies
>
>Terry
>
>>>
>>>Select pxEntryCodes
>>
>>If pxEntryCodes it is in EOF(), RECNO()=RECCOUNT()+1, and you cannot use this for a GO command
>>( this is a VFP bad design )
>>
>>>  lnRecNo	  = RECNO()
>>>  If .lHide
>>>      Set Filter To EMPTY( FacCatCode)  && i.e. hide all those that have a value
>>>  Else
>>>      Set Filter To
>>>  Endif
>>
>>Use LOCATE here
>>
>>>  Go Top
>>>  .grdEntryCodes.Refresh()  && Daughter grid
>>>  Select pxEntryCodes
>>
>>* use this
>>IF m.lnRecNo<=RECCOUNT()
>>>  Goto lnRecNo              && erroneous statement
>>ENDIF
>>
>>>
>>>
>>>Now there are 10 recs in this table (pxEntryCodes) and 56 in its daughter. When all data have been disappeared and I toggle back to display, with the above routine, I get "Record out of range" for the granny and the daughter, i.e. rec no. 11 and 57 respectively.
>>>
>>>This suggests that after the filter has been set (on the hide toggle) each table has its record pointer at a "mythical" extra record, at the eof, which is what gets stored in lnRecNo.
>>>
>>>At the moment I've commented out the recno bits and left it at Go Top for both grids - no problem. But I would prefer them to go back to the records upon which they weere focusing before the hide toggle.
>>>
>>>Any enlightenment?
>>>
>>>'Ppreciate it
>>>

>>>Terry
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform