I have a VFP 6 form with one parent table, three child tables, and two grandchild tables. My form has a page frame, with each page displaying from one of the tables. There are no links among any of the tables, and no cursors in the data environment. Instead I open the tables with code in the Load method. There can be several records in each of the child tables (for instance, a series of items) that match a record in a parent table. The form is intended to operate over a network.
Filters are originally set by code in user-created methods use SET FILTER to insure that the appropriate records are visible.
I have been able to speed up my form in several ways:
? I only refresh the active page of the page frame. I do this with a CASE statement in a method I created that determines which page is the active page and then refreshes it.
? Rather than use alias names in the filter condition, I save the value of the key field in a variable, and then use this value to filter the child records. The code for doing this is in a method I created.
? I have an additional method containing similar code for filtering grandchild records with respect to the child records.
? I only run filtering for the tables relevant to the active page of the page frame. I use CASE statements in another method I defined to determine what tables to filter.
*Code for filtering child records.
PARAMETERS tablename
pkey = ptable.pono
SELECT & Selects the table to be filtered.
SET FILTER TO pno = pkey &&ptable.pno
LOCATE
*code for filtering grandchild records.
PARAMETERS tablename
pitemkey = ctable.pno + ctable.pitem
SELECT &tablename
SET FILTER TO pno+pitem = pitemkey &&ctable.pno + ctable.pitem
LOCATE
The form works correctly, with one exception. The pages showing the grandchild records refresh only if I click onto one of the other pages and then click back again. This is a problem whether I first open the form or scroll from one record to another record.
Can anybody suggest ways to solve this problem?
Filters are originally set by code in user-created methods use SET FILTER to insure that the appropriate records are visible.
I have been able to speed up my form in several ways:
? I only refresh the active page of the page frame. I do this with a CASE statement in a method I created that determines which page is the active page and then refreshes it.
? Rather than use alias names in the filter condition, I save the value of the key field in a variable, and then use this value to filter the child records. The code for doing this is in a method I created.
? I have an additional method containing similar code for filtering grandchild records with respect to the child records.
? I only run filtering for the tables relevant to the active page of the page frame. I use CASE statements in another method I defined to determine what tables to filter.
*Code for filtering child records.
PARAMETERS tablename
pkey = ptable.pono
SELECT & Selects the table to be filtered.
SET FILTER TO pno = pkey &&ptable.pno
LOCATE
*code for filtering grandchild records.
PARAMETERS tablename
pitemkey = ctable.pno + ctable.pitem
SELECT &tablename
SET FILTER TO pno+pitem = pitemkey &&ctable.pno + ctable.pitem
LOCATE
The form works correctly, with one exception. The pages showing the grandchild records refresh only if I click onto one of the other pages and then click back again. This is a problem whether I first open the form or scroll from one record to another record.
Can anybody suggest ways to solve this problem?