Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is Goto recno('CA_View') reliable?
Message
From
03/02/2017 12:13:03
 
 
To
03/02/2017 12:10:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01647432
Message ID:
01647437
Views:
32
>>>>This case is using Cursor Adapter.
>>>>I have a routine in a method where a user adds a bunch of new records to the CA view/cursor. Then the code needs to "jump" from some record to another record (in this CA View). Note that the PK is not yet set in this view/cursor (since these are new records and have not been saved yet).
>>>>My code is using the following approach.
>>>>When I need to go from a record to another record I use RECNO("CA_view") stored into a variable.
>>>>For example:
>>>>
>>>>nRecno = recno("CA_view")
>>>>SELECT ("CA_view")
>>>>GOTO nRecno
>>>>
>>>>Is this approach, using the RECNO() in the cursor reliable?
>>>>
>>>>TIA
>>>
>>>Since nRecno is the current record number in CA_view, the record pointer isn't changed. So in a way your code only changes the work area, nothing more.
>>
>>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.
"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
Next
Reply
Map
View

Click here to load this message in the networking platform