Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Did I miss something?
Message
From
07/02/2002 08:51:30
 
 
To
06/02/2002 17:42:54
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00615839
Message ID:
00616556
Views:
18
>Tamar,
>I did most of my preVFP coding in FoxProDos2.5. I believe the behavior of the replace command in VFP is significantly different than in 2.5, however, before completing the end of this sentence I went back and did some testing in 2.5 and sure enough if the current record is at eof() replacements are not done in referenced tables. Was this a generally know bug? error? The 'replace in' command was not available in 2.5. It sure is hard changing the way I write a replace statement after having done it a certain way for 10 years and untold thousands of time.

What Andy said. FWIW, here's what we wrote in HackFox about this:

The fields do not all have to be in the same table. However, there's a gotcha here. The Scope, FOR and WHILE clauses are applied to the controlling table (usually the current work area). If you reach EOF() in that table, no further replacements take place in any table. Despite much yelling by many Xbase programmers over the years, this really isn't a bug. It's supposed to work this way and it's as good a choice as any other behavior in this situation.

Here's the deal. REPLACE lets you change fields of multiple records in multiple tables at once. Suppose you've written a REPLACE that moves data into records from three different tables at once. Suppose further that the REPLACE has a scope clause of NEXT 5. What if you reach the end of one of those tables before you've hit five records? For simplicity's sake, the rule has always been that it's the current work area that counts. As long as you're not at EOF() in the current work area, the REPLACE continues (although some data may land in the bit bucket). As soon as you hit EOF() in the current work area, the REPLACE ends. No questions asked. (For explanations of Scope, FOR and WHILE, see "Xbase Xplained.")

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform