Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replace All while not plStop
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00672137
Message ID:
00672617
Vues:
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
I want to be able to stop the process.

So, I have something like this
ON ESCAPE plStop = messagebox('Are you sure you want to stop replace process?,36,'Stop process')=6

So, user can hit ESC and the process would be stopped.

That's the idea, and it similar to Sergey's SCAN solution, but SCAN is slower than one replace command.

However, WHILE clause always makes the process to start from the current record, and I was not aware of it (or didn't realize it). So, in order to fix the problem my colleague put GO TOP at the top on the command button Click method. Unfortunately, there are multiple replaces under certain conditions, so this is still a partial solution...
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform