Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replace fields with relation
Message
From
27/06/2014 13:47:16
 
 
To
27/06/2014 13:29:10
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Environment versions
Visual FoxPro:
FoxPro Windows
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
DB2
Application:
Desktop
Miscellaneous
Thread ID:
01602617
Message ID:
01602710
Views:
37
This is exactly why my post on this was to turn the whole thing around.

>Good question. It's actually quite ugly. You get as many replacements as there are records in the current work area. Here's what we said in HackFox:
>
>"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."
>
>Bottom line is that one should NEVER do REPLACE in a work area other than the current work area. In recent versions, adding IN to REPLACE solves the problem. In FP2.x, every REPLACE should be preceded by the appropriate SELECT command.
>
>Tamar
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform