>>>>The fastest and most correct way is
>>>>
>>>>
replace myval with int(myval) for myval < 7 in alias
>>>>
>>>>The only time myval needs an alias is when you're replacing across multiple aliases joined with set relation - a technique that should be avoided.
>>>
>>>But this would change all records in myval<7. Might not be intended.
>>
>>Yes, that's a gotcha in the VFP help file. The help file says "The default scope for REPLACE is the current record (NEXT 1)." It doesn't mention that if you include a FOR clause, the scope defaults to ALL.
>>
>>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.
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