Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replace All while not plStop
Message
 
 
À
26/06/2002 15:20:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00672137
Message ID:
00672649
Vues:
8
>Nadya,
>
>Well, I was going to suggest adding "and !plStop" to the FOR clause, but I think REPLACE would still continue reading records to determine if changes should be made...
>

Steve,

I think your idea would work as well, but there are reasons, why I choose WHILE approach.

We construct REPLACE command and then execute macro.

If ForCondition is empty, we put ALL. I also think, that if we have FOR condition, we probably should put it in (), etc.

So I choose the easier route. I didn't make any measurements, what is faster
REPLACE FOR (ForCond) and not plStop
or
REPLACE FOR ForCond WHILE not plStop
The table is table buffered. In addition validations should fire in batch mode (though I believe, I disabled them - but it's not my application, so they probably have to be re-activated).


>Is hitting the key actually triggering plStop to change values while the replace statment is in the middle of executing?
>

Yes, part of replace command was already executed. Suppose, user was tired of waiting of long replace command or suddenly realized, that he/she constructed it wrong, etc. The process could be terminated, but several records were already replaced. Of course, the user can press Revert button on the main form to undo the changes.

In our applications we developed a form called Global Editor. It allows to replace field with (options)

1) a Constant
2) with a content of another field
3) swap two fields
4) delete group of records.


>>
>>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