Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GOTO on Filtered data
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00962533
Message ID:
00962537
Views:
8
Hi Terry,

I would adjust code as follow
  Select pxEntryCodes
  IF BETWEEN(RECNO(), 1, RECCOUNT())
      lnRecNo  = RECNO()
  ENDIF

  If .lHide
      Set Filter To EMPTY( FacCatCode)  && i.e. hide all those that have a value
  Else
      Set Filter To
  Endif
  ***Go Top
  LOCATE   && It's Rushmore optimizable and GO is not
           && wouldn't make difference on small record set, though
BTW, SET FILTER by itself doesn't move record pointer even when current record doesn't satisfy the filter conditions.

>Here's an intersting one. I have a checkbox on my form that toggles display/hide all the records in 3 grids (granny-mother-child) that don't have a certain field set in them. When the field is set for all recs in the Granny table then all data in the descendant tables are disappeared. Correct.
>
>Below is a sample of the code to hide data in the Granny table/grid. The daughter table's code is almost identical.
>
>
  Select pxEntryCodes
>  lnRecNo	  = RECNO()
>  If .lHide
>      Set Filter To EMPTY( FacCatCode)  && i.e. hide all those that have a value
>  Else
>      Set Filter To
>  Endif
>  Go Top
>  .grdEntryCodes.Refresh()  && Daughter grid
>  Select pxEntryCodes
>  Goto lnRecNo              && erroneous statement
>
>
>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.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform