Appearance
StopExecution
Declaration
Procedure StopExecution;
Example
pascal
procedure OnMapEvent(var Value:Variant);
begin
if Value > 10 then
begin
StopExecution;
//this line will execute;
Exit;
//this line will not execute;
end;
end;Description
Cancels the execution of the Map (or Custom Script) immediately after the current script, and cancels any subsequent Step(s) in that Action. Any code lines in the script following this function will still be executed. Use Exit to stop the processing of the remainder of the script.
The status of the Action is set to Cancelled (for Flow Logs and Notifications).
If the Action has one or more Actions Steps after the Map or Custom Script, the subsequent step(s) will not execute. To allow execution of any subsequent Action Step, use CancelExecution.
The Action Steps to be executed by an Action can be controlled by setting, or clearing, the check-box "Execute next Action Step even if previous one is cancelled" (on the Action's Execution tab). If this has been set then the Action will not show as Cancelled in the Flow Logs - not even when all Action Steps were Cancelled nor when the StopExecution statement is called. The check-box corresponds to the Action.IgnoreCancel property and this can be set or cleared via script. For example, when it is wanted that a multi-Step Action show as Cancelled in the Logs, then the property could be cleared part way through the Action (at run-time) so that StopExecution will have full effect:
pascal
if (SampleDataSource.RecordCount = 0) then
begin
Action.IgnoreCancel := False;
StopExecution;
end;