Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replace All while not plStop
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00672137
Message ID:
00672455
Views:
8
>>You are replacing while a memory variable is either T or F. So, if the memvar is .F., nothing happens. Nothing in the REPLACE is changing the value of the memvar unless you have some UDF in the command. The use of FOR and WHILE in a REPLACE does work,, it is just usually used with a logical test of some field in the record set.
>>
>
>While not myVar would be always true, if myVar = .f. So, why this condition doesn't work? From the logical point of view this condition is evaluated to .t., so it should not affect the replace command.

I do not see the point of using a logical Variable in the SCOPE of a replace. During a replace, this would be a constant value. So if true, the replace would occur for all records unless you have another expression in a FOR/WHEN clause. If false, nothing would happen. So using a logical memvar just gives the REPLACE command something else to evaluate [i.e., degrade performance] that is not really necessary. In short, I do not understand the purpose of using a memvar which would have a constant value during a REPLACE. If you need to execute something based on the value of a MemVar, I would do this:
if m.SomeMemVar
   replace FieldX with m.Val1 ;
      for some_other_expression ;
      while [TableX.]Cust_ID = m.nCust_ID
endif
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform