>I just want to make sure that my thinking is correct.
>
>I have the following code.
>
>Do While seek(vi_key)
> Replace key with l_key
> tableupdate()
>enddo
>
>My question is: If I move the tableupdate out of the loop, will the seek see the updated records with their new values? I do not want it to, so that is why I am thinking of moving the update out of the loop.
>
>THanks in advance.
>Christine
Christine
As far as I can see, it would continue to seek & find each rec with {some field} = vi_key (don't know what field you're seeking on - maybe it's "key")
If that happens to be the same as l_key then the updated recs MAY be "seen" by the next seek in the loop. But that would be pointless, replacing the value with the same value.
Depending on what buffering you use, the moving on of the file pointer should equiv. of TableUpdate anyway (if buffering = 3)
Why not have buffering set to 5 - table optimistic, then do the TableUpdate after the loop.
I've never used seek in the way you have and I can't be sure of the results. Maybe yours is more sophisticated but, call me old-fashioned, I'd have.
If SEEK( vi_key)
Scan while {seeked_key} = vi_key
Replace key with l_key
EndScan
= tableupdate(.T.)
Endif
HTH
Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.