4D Blog

Home Product Exciting enhancements for managing processes and sessions

Exciting enhancements for managing processes and sessions

October 29, 2024

Product

Managing processes and sessions is essential for optimizing and monitoring your 4D applications. You can easily manipulate and retrieve crucial information about these elements thanks to different commands.

With 4D 20 R7, we are pleased to announce a series of enhancements that make these functions even more accessible and effective. These new features are designed not only to simplify your work, but also to boost the performance of your code. The improvements include:

  • Getting the process info in an object to make it easier to manipulate the properties,
  • Allowing direct access to session info using a session ID for easier management,
  • Making it easier to get a process number directly from its ID,
  • Accessing the creation date of a process
  • Optimized filtering of the results returned by the Process activity command to obtain all processes in a session.

 

Find out how these updates can transform your development experience and improve the efficiency of your applications!

HDI: Process properties, Session properties, and Process activity in action

Retrieve the info for a process or a session

New Process info command

The new Process info command returns an object. The advantage of this syntax comes from its ability to retrieve the info in an object, making them easier to handle than using multiple variables. So, the _O_PROCESS PROPERTIES command has been deprecated.

var $process : Object
$process:=Process info($processNumber)

The Process info command returns a new property, creationDateTime. This property lets you find out when a process was created.

Example output:

{
    "number": 4,
    "name": "Application process",
    "sessionID": "3C81A8D7AFE64C2E9CCFFCDC35DC52F5",
    "ID": 4,
    "visible": true,
    "type": -18,
    "state": 0,
    "creationDateTime": "2024-09-22T12:46:39.243Z",
    "preemptive": false,
    "systemID": "123145476132864",
    "cpuUsage": 0,
    "cpuTime": 0.006769
}

For example, to know if my process is preemptive:

var $preemptive : Boolean
$preemptive:=Process info($processNumber).preemptive

New Session info command

The new Session info command lets you retrieve the info of a session using its sessionID. You could already retrieve this information with the Process activity command. The advantage of this new command is that it returns a simple object, saving time and performance.

var $session : Object
$session:=Session info($sessionID)
$session:=Session info(Process info($processNumber).sessionID)

Example output:

{
    "ID": "3C81A8D7AFE64C2E9CCFFCDC35DC52F5",
    "userName": "Designer",
    "machineName": "My Computer",
    "systemUserName": "John Doe",
    "IPAddress": "localhost",
    "hostType": "mac",
    "type": "remote",
    "state": "active",
    "creationDateTime": "2024-09-10T09:55:54Z",
    "persistentID": "8FFDAE519F1F4DCDB81E8E8DB00AD101"
}

Retrieve process number from process ID

The Process number command has been updated. It is now possible to pass the process ID to retrieve the process number directly, in addition to the previous method of using the process name.

var $processNumber : Integer
var $processName : Text
var $processID : Integer

// From process name
$processNumber:=Process number($processName)

// From process ID
$processNumber:=Process number($processID)

Improvement for Process activity command

Filter processes by session

The Process activity command lets you retrieve the list of processes and sessions. If you pass the Processes only or Sessions only option, you retrieve either the list of processes or the list of sessions. Now, you can filter your results more efficiently. Just pass a session ID to retrieve the list of the processes linked to the session.

Here are the different possible combinations:

// return all sessions and processes
$o:=Process activity()

// return all processes
$o:=Process activity(Processes only)

// return all sessions
$o:=Process activity(Sessions only)

// return the session passed in parameter and all linked processes
$o:=Process activity($sessionID)

// return all processes linked to the session passed in parameter
$o:=Process activity($sessionID ; Processes only)

// return the session passed in parameter
$o:=Process activity($sessionID ; Sessions only)

Retrieve the creation date of a process

The new property, creationDateTime, has also been added to the Process object returned by the Process activity command. So, you can easily retrieve the creation date of any process.

Example output:

{
"processes": [
          {
             "name": "Application process",
             "sessionID": "3C81A8D7AFE64C2E9CCFFCDC35DC52F5",
             "number": 4,
             "ID": 4,
             "visible": true,
             "systemID": "123145476132864",
             "type": -18,
             "state": 0,
             "cpuUsage": 0,
             "cpuTime": 0.006769,
             "creationDateTime": "2024-09-22T12:46:39.324Z",
             "preemptive": false
           }
    ]
}

Dive Deeper

For more details on these exciting changes, please check out the updated documentation on these commands. We can’t wait to hear your thoughts, join the conversation on our forum!

Discuss

Tags 20 R7, 21, Administration, Process, Programming, Session

Latest related posts

  • June 16, 2025

    Generate, share and use web sessions One-Time Passcodes (OTP)

  • May 20, 2025

    Automatic Refresh of OEM Build Licenses

  • May 16, 2025

    New class to handle incoming TCP connections

Vanessa Talbot
Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy