Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Recursive loop and SCAN
Message
 
 
To
26/07/2002 22:41:45
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00683191
Message ID:
00683197
Views:
32
>>In general, for recursive code to work the variables should be local to the recursive function. A cursor is 'a global variable' in this case. Can you provide more info about what are you trying to do?
>
>Yes, variables are local. However, it was my assumption that SCAN, for the ENDSCAN loop, was, not only resetting to the proper alias but also to the proper record. Correct me if I'm wrong, but it only resets to the proper alias. To resolve that issue in the recursive loop, I had to save the RECNO() before calling the recursive loop and restore it after. I guess this could be a nice improvment to request for the SCAN in the next version.

The SCAN/ENDSCAN only restores proper alias. It doesn't restore record pointer. I don't know what you're doing but maybe you can use USE ... AGAIN instead of using the same cursor. This way cursor became "local".
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform