Trying to step through child records in a set to use values in child to do lookups to outside table for pricing. Have tried using examples in manual, opening 2nd instance of child outside of set and fetching there, etc. Fetch_find, etc, end with same results. Have run database compact, rebuilt indexes, etc, a few times without change. Apparently I'm leaving out some little step or have a syntax error?.
Test set has 2 tables a one-to-many link. Test form consists of a couple buttons, named browse, a text label to show where the code is at, and a variable to count fetches. Browse correctly shows all applicable records. The code will exit properly when there is only 1 child, but when there is more than 1 child records it gets "stuck" on the 2nd record (ie: continues to show 2nd record when it should be advancing or exiting).
In the code, TestBanner is a text label used to display test data, and VAR->Item_Amt_1 (defined at form level) is used to show how many times the fetches have occured. The ui_ was added to provide a means of exit. This is the code in its "nearly" most basic form.
Tbl1 = table.current(1)
Tbl2 = table.current(2)
Counter = 0
Tbl2.fetch_first()
while .not. Tbl2.fetch_eof()
TestBanner.text = "TEST VAL : " + Tbl2.Inv_Nbr + " " + Tbl2.Seq_Nbr + " " + TTbl2.Item_Code
Counter = Counter + 1
Code = ui_get_radio("EXIT",1, "NO", "YES")
IF Code = "YES" THEN
GOTO Fin
END IF
Tbl2.fetch_next()
VAR->Item_Amt_1 = alltrim(str(Counter))
end while
Fin:
end
Test set has 2 tables a one-to-many link. Test form consists of a couple buttons, named browse, a text label to show where the code is at, and a variable to count fetches. Browse correctly shows all applicable records. The code will exit properly when there is only 1 child, but when there is more than 1 child records it gets "stuck" on the 2nd record (ie: continues to show 2nd record when it should be advancing or exiting).
In the code, TestBanner is a text label used to display test data, and VAR->Item_Amt_1 (defined at form level) is used to show how many times the fetches have occured. The ui_ was added to provide a means of exit. This is the code in its "nearly" most basic form.
Tbl1 = table.current(1)
Tbl2 = table.current(2)
Counter = 0
Tbl2.fetch_first()
while .not. Tbl2.fetch_eof()
TestBanner.text = "TEST VAL : " + Tbl2.Inv_Nbr + " " + Tbl2.Seq_Nbr + " " + TTbl2.Item_Code
Counter = Counter + 1
Code = ui_get_radio("EXIT",1, "NO", "YES")
IF Code = "YES" THEN
GOTO Fin
END IF
Tbl2.fetch_next()
VAR->Item_Amt_1 = alltrim(str(Counter))
end while
Fin:
end
Comment