PDA

View Full Version : Fetching thru one-to-many linked .dbfs


ABC123

DonWalton
10-29-2014, 02:18 PM
I have Version 12. In the past it seeme to me that i could FETCH thru the parent using a WHILE command and within this WHILE search thru it's children with no problem!! Have been trying to do this with the new version and it does not seem to be following the index that i have set!!
In this example PAR is the parent; CHI the child; The index was set on pohead_id in both DBFs.. What am i doing wrong?

par.fetch_first()
while .NOT. par.fetch_EOF()

chi.fetch_first()
while .NOT. chi.fetch_EOF()

chi.fetch_next()
end while

end while

Don Walton 352-243-3303

Tom Cone Jr
10-29-2014, 03:05 PM
How are you establishing the pointers "par" and "chi" ?

If you're opening tables directly in your script you will want to use fetch_find() for the child, not fetch_first(). Use the current link field value (from the par table) to do the fetch_find().

-- tom