>>>>>>
>>>>>>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
>>>>>>
>>>>>
>>>>>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.
>>
>>Hmm, that's going way back in time. I know for sure the REPLACE command has been around since early dBASE days. SCAN was introduced in FPD if memory serves. ISTR the FOR clause of REPLACE has also been around forever, I believe it predates SCAN, so it wasn't introduced to fix anything to do with SCAN.
>
>I know this is from the days where the
user was hacking the code in command line and a SCAN construct was inconvenient so yes, it might be there from start, and REPLACE the more basic command.
>Software archaeology. :)
>
>Please define: ISTR
I Seem To Recall.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up