Message
 
 
To
03/02/2017 12:41:53
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01647432
Message ID:
01647444
Views:
30
>>>>I didn't write my example correctly, you are right. I store all values of the RECNO("CA_view") in a cursor (in some rendom order). Then I select that, second cursor, and jump from one record to another. Here a modified code:
>>>>
>>>>SELECT C_SomeCursor
>>>>GO TOP
>>>>do while !eof()
>>>>     nRecno = C_SomeCursor.Rec_no 
>>>>     SELECT ("CA_view")
>>>>     GOTO nRecno
>>>>     *-- Program does something to a record
>>>>     SELECT C_SomeCursor
>>>>     SKIP
>>>>enddo
>>>>
>>>>
>>>>In the above case, is GOTO method reliable?
>>>
>>>I don't user CA myself, but I am pretty sure that Goto is reliable. Unless your "does something to a record" is a bunch of stuff, I am pretty sure that all the lines you show can be done in a single SQL Update command.
>>
>>I wish it were that simple. I will continue relying on GOTO. I have been doing it for a long time but all of a sudden had doubts if this works. Thank you.
>
>It is simple and it will be reliable until the record numbers in your cursor change. They can change in, IIRC, these cases:
>
>- requery() - you may get a completely different set of records, so nRecno may be way beyond current eof() or it may be pointing to a real record but completely different from the record from which the recno() was taken
>- new records have negative recno(), but it becomes a positive number after tableupdate().
>- zap, but that's trivial
>- zap plus insert into / append from, but that's pretty much the same as requery().

Thank you for all the cases to watch for.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View