KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Obtaining the list of the process names and IDs
PRODUCT: 4D | VERSION: 2003.2 | PLATFORM: Mac & Win
Published On: March 4, 2004

Here is an example of how you can obtain the list of the ongoing process in a 4D Database.

  ` Project Method: Process_List

C_POINTER($1;$2;$arrProcName;$arrProcNum)
C_LONGINT($vlNbTasks;$vlActualCount;$vlProcess;$vlState;$vlTime)
$arrProcName:=$1
$arrProcNum:=$2
$vlNbTasks:=Count tasks

ARRAY STRING(31;$arrProcName->;$vlNbTasks)
ARRAY INTEGER($arrProcNum->;$vlNbTasks)
$vlActualCount:=0
For ($vlProcess;1;$vlNbTasks)
  If (Process state($vlProcess)>=Executing )
    $vlActualCount:=$vlActualCount+1
    PROCESS PROPERTIES($vlProcess;$arrProcName->{$vlActualCount};$vlState;$vlTime)
    $arrProcNum->{$vlActualCount}:=$vlProcess
  End if
End for
ARRAY STRING(31;$arrProcName->;$vlActualCount)
ARRAY INTEGER($arrProcNum->;$vlActualCount)

Here is an example on how to call this method:

ARRAY STRING(31;arrProcName;0)
ARRAY INTEGER(arrProcNum;0)
Process_List (->arrProcName;->arrProcNum)