Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF syntax
Message
From
15/09/2015 01:14:29
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
14/09/2015 17:08:24
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01624559
Message ID:
01624606
Views:
46
>>>
>>>CREATE CURSOR Test ( iInt I )
>>>INSERT INTO Test ( iInt ) VALUES ( 1 )
>>>INSERT INTO Test ( iInt ) VALUES ( 2 )
>>>GO TOP IN Test
>>>REPLACE iInt WITH 5 FOR iInt < 3 IN Test && 2 replacements
>>>
>>
>>See message#1624599 :)
>>
>>BTW: GO TOP is superfuous. ALL and implicit ALL in FOR will do anyway.
>
>The purpose of the code was to demonstrate the default scope when the FOR clause is included. If it was NEXT 1 as the VFP help file says, then only the top row would get REPLACEd. Since both rows are affected, it proves that the default scope is ALL.

But for the ones not knowing it might be even more surprising that it will run through all records from the last (second) record too.
I think the problem comes from the SCAN ENDSCAN use of FOR WHILE and scope. In SCAN it is clear what FOR means. So instead of
SCAN FOR expr
 REPLACE ...
ENDSCAN
the
 REPLACE ... FOR expr
was introduced.
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform