Tech Tip: Aborting a process by number
PRODUCT: 4D | VERSION: 17 R4 | PLATFORM: Mac & Win
Published On: February 22, 2019
Here is a utility method that will abort a process by number that is generating using the NEW PROCESS command:
//--------------------------------------------------------------------------------- // Name: ABORT_PROCESS_BY_NUMBER // Description: Method will abort the process by number that was generated by the // New Process command. // // Parameters: // $1 (LONGINT) - Process Number // -------------------------------------------------------------------------------- C_LONGINT($1;$processNum;$i;$ID) C_COLLECTION($activity) $processNum:=$1 $activity:=Get process activity(Processes only).processes For ($i;0;$activity.length-1) If ($activity[$i].number=$processNum) $ID:=Num($activity[$i].ID) $i:=$activity.length+1 End if End for If ($ID>0) // Processes that are not internal processes ABORT PROCESS BY ID($ID) End if |
Here is an example of aborting the process by a given number:
The process number is "6" which can be aborted with the method:
ABORT_PROCESS_BY_NUMBER ($process) |
The process will display aborted:
See Also:
Commented by Vance Villanueva on March 25, 2019 at 8:01 AM
Noted. Thanks for the catch.
Commented by Vincent de Lachaux on March 23, 2019 at 5:46 AM
With dot notation:
$c:=Get process activity(Processes only).processes.query("number = :1";$1)
if ($c.length=1)
ABORT PROCESS BY ID($c[0].ID)
end if