This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
Process activity

Process activity 


 

Process activity {( {sessionID}{;}{options} )} -> Function result 
Parameter Type   Description
sessionID  Text in Session ID
options  Longint in Return options
Function result  Object in Snapshot of running processes and/or (4D Server only) user sessions

The Process activity command returns a snapshot of running processes and/or (4D Server only) connected user sessions at a given time. This command returns all processes, including internal processes that are not reachable by the Process info command.

By default when used without any parameters, Process activity returns an object containing the following properties: 

  • "processes", a collection of all processes 
  • "sessions" (4D Server only), a collection of all sessions

On 4D Server, you can filter information to be returned using the optional sessionID and options parameters:

  • If you pass a user session ID in the sessionID parameter, the command only returns information related to this session. By default if the options parameter is omitted, the returned object contains a collection with all processes related to the session and a collection with a single object describing the session. If you pass an invalid session ID, a null object is returned. 
  • You can select the collection(s) to return by passing one of the following constants of the "4D Environment" theme in the options parameter:
    Constant Type Value Comment
    Processes and sessions Longint 0

    Returns both "processes" and "sessions" lists (default value)

    Processes only Longint 1

    Returns only the "processes" list

    Sessions only Longint 2

    Returns only the "sessions" list

Note: When executed on 4D in remote or local mode, Process activity always returns the list of running processes (sessionID and options parameters are ignored).

The "sessions" property contains a collection of objects describing all running sessions on the server.

For a description of session object properties, please refer to the Session info command.

Notes: 

  • You can get the object of a session using the Session command.
  • Process activity returns remote client sessions, stored procedure session and rest sessions but not Web sessions (limitation).  

The "processes" property contains a collection of process objects describing all running processes. 

For a description of process object properties, please refer to the Process info command.

On the server, the Process activity command returns an additional "session" property:

 

Additional propertyTypeDescription
sessionObjectThe .info property of the session in which the process is running. Undefined if the Processes only parameter is passed.

You want to get the collection of all user sessions:

  //To be executed on the server
 
 var $o : Object
 var $i : Integer
 $processName;$userName Text
 
 $o:=Process activity //Get process & session info
 For($i;0;($o.processes.length)-1) //Iterate over the "processes" collection
    $processName:=$o.processes[$i].name
    $userName:=String($o.processes[$i].session.userName// Easy access to userName
  //use String because session object might be undefined
 End for

You want to get all processes related to the current session:

  // to be executed on the server
 
 var $sessionID : Text:=Session.id
 var $o : Object
 
 $o:=Process activity($sessionID ;Processes only)



See also 

_o_PROCESS PROPERTIES
Process info
Session storage by ID
WEB Get server info

 
PROPERTIES 

Product: 4D
Theme: Processes
Number: 1495

This command can be run in preemptive processesDifferent in remote mode

 
PAGE CONTENTS 
 
HISTORY 

New
Created: 4D v16 R4
Modified: 4D v16 R5
Modified: 4D v17 R5
Modified: 4D v19 R4
Modified: 4D v20 R7
Renamed: 4D v20 R7 (Get process activity)

 
ARTICLE USAGE

4D Language Reference ( 4D v20 R7)