What’s new in 4D v18 R5

ORDA data model classes

Scope and execution context for functions

By default in client/server mode, functions are executed on the server. Now you can choose to execute some functions on the client thanks to a new keyword: local. Also, you have the power to choose which functions to publish (or not ) as APIs for REST clients with the new keyword: exposed


Shareable entity selections

Sometimes you may want to share an entity selection with another process or make it available to all processes. For example, imagine you are performing a complex query to find all overdue invoices, allow end-users to select some (or all) of them, and send a payment reminder via email. Sending emails is best done in another process to avoid blocking the user. Instead of building a list of primary keys to pass to the other process, a shared entity selection can be directly passed to another process. Shared entity selections can even be attached to the Storage object to be shared with all processes.

In a nutshell, an entity selection can be shareable or non-shareable:

  • A shareable entity selection can be stored in a shared object or a shared collection and can be shared between several processes or workers. It does not allow the addition of new entities. Trying to add an entity to a shareable entity selection will trigger an error.
  • A non-shareable entity selection cannot be shared between processes, nor can it be stored in a shared object or collection. Trying to store a non-shareable entity selection in a shared object or collection will trigger an error. However, a non-shareable entity selection accepts the addition of new entities.

Form editor

CSS Preview in the form editor

You can now preview the final CSS rendering in the Form editor. A new icon is available in the toolbar allowing you to view your form with or without the CSS rendering, even showing how it would look with specific CSS rendering on Mac or Windows. As for overriding properties in CSS mode, a new shield type (similar to the shields for Object Method or Entry Order) is displayed in the Form editor. Now it’s easy to see which objects are impacted by a CSS.


Macros are now available in the Form editor. With a form macro, you can:

  • Modify, delete, or add a property to one or more objects
  • Add or delete one or more form objects with its associated method
  • Select or deselect form objects in the editor
  • Display a modal dialog to enter a parameter on the fly
  • Calculate the ideal position of form objects and move them
  • Create a CSS class from a form object to use as a template
  • Check that image paths in the form are valid
  • Open CSS files in your CSS editor instead of searching files on disk
  • Check that XLIFF references have their correspondence in the XLIFF files
  • and so much more!

Form macros are available from the contextual menu. Host database macros are displayed first, followed by component macros. To execute a macro, simply click on the menu item. To create form macros, simply declare them in a formMacros.json file at the first level of the Sources folder in your project.


New command to open the form editor

A new 4D command to open a form in the Form editor is available. This can be especially useful for analysis or introspection tools. The new command is called: FORM EDIT.

4D for iOS

Deep linking 

Deep linking allows you to share a URL. Clicking on the URL will directly open a specific record in a 4D for iOS app. In combination with push notifications, you can inform sales people about a new quote or insurance agents about a new case. A single click directly opens the app and displays the appropriate record.


Optimized data synchronization 

4D for iOS data synchronization process has been optimized, giving you up to 25 times faster data sync.

Programming-related features

Naming parameters for functions and methods

There’s no need to go through an intermediate variable, you can now name your parameters and results when declaring a:

  • project method,
  • trigger,
  • database method,
  • form method,
  • class constructor,
  • class function.

Remote debugger

This feature allows you to decide where you want to debug your server code (on the client-side or server-side).

Two new menu items have been added (on both sides) to manage the debugger attachment:

  • Attach / Detach debugger: Instantly attach or detach the debugger to your client or server.
  • Attach debugger at startup: Attach the debugger when you start your client or server. 

Keep in mind, the debugger can only be attached to a single instance of 4D at a time. For example, if you try to attach the debugger to your server without detaching it from the client, an error message appears with information on the debugger owner.

And to help you differentiate if the debugger or the error windows are from the server or the client, we’ve changed the look of these windows.


Deployment-related features

Customize 4D cache folder for merged 4D server

If your machine hosts a merged server application built with different 4D versions, you may encounter issues due to the shared 4D structure folder. In order to avoid sharing this system folder between merged server applications built with different 4D versions, you can now define the folder name during the build application process with the new buildApp key to set your own structure folder.


Customize 4D cache folder for merged 4D clients

Connecting your remote application to several servers can sometimes result in obtaining a large local resources folder in the system which can be time, volume, and network consuming. Now you have the ability to share the same local resource folder between all identical servers with the new buildApp key to share the local resources folder.

Integrate journal without aborting at the first error 

When running 4D Server in production, everything should be fully automatic without requiring an administrator. This is especially important with Auto Update and operating in Headless mode. After a power loss or crash, minor errors in the journal might stop an automatically restarted 4D Server. A new option now allows suppressing non-critical error messages (but still reporting them in a log), reducing system downtime.

Emails (IMAP)

Search and download Emails

Search allows retrieving a list of messages based on criteria such as all unread emails or all emails from a specific person within the last 4 weeks. The command returns a collection of mail IDs, which can be used directly by the new getMails method to download them.



Copy, move and delete emails

Three new functions have been added to the IMAP transporter: copy()move(), and delete().


Improved type ahead

Normally, a list box only receives keystroke events in edit mode. However, this prevents it from being used to automatically filter the list or select an entry when a user was using the keyboard and a non-enterable list box.

Now, the On before Keystroke event is generated as soon as the list box has focus and a key is typed, even if data isn’t being entered into a cell. This allows 4D to know which keys have been pressed and makes it possible (by programming) to make decisions such as starting a new search or changing the current selection.

The new Is editing text command has been added to help determine if there is an ongoing input when the On before keystroke event is generated. For example, it allows a list box to be editable – and still supports type-ahead features. On before keystroke and On after keystroke events now support system help dialogs to select diacriticals such as é, ä, or Asian characters. The event is delayed until the end-user selects the final characters. There’s no need to handle this yourself.


4D Write Pro

Select character for decimal tabs

If you have documents from various sources, the numbers may not be correctly formatted for your needs. Now, 4D Write Pro lets you specify this setting for each document. You can choose to align numbers either to:

  • the point,
  • the comma,
  • the first separator found (point or comma),
  • or the separator defined in the operating system.

In order to maximize compatibility (with MS Word in particular) option #3 is used by default when creating new documents. When migrating 4D Write documents to 4D Write Pro, the system-defined separator is used by default.


Manage soft hyphens

The insertion of soft-hyphens has been simplified by providing new standard actions, as well as new buttons in the 4D Write Pro Interface widgets.

Two new standard actions are at your disposal:

  • insertSoftHyphen
  • removeSoftHyphens

The functionality has also been added to the 4D Write Pro Interface widgets in both the toolbar widget and the sidebar widget.


Select pages to show

4D displays only the pages mentioned in the collection, in the order of the collection. This allows reducing the feature set to make it simpler for the end-user. If only style options are needed, it’s better to not even display all of the other functionalities. Now, the 4D Write Pro widget provides the ability to select which pages to display with the new WP ShowTabPages component method. Simply pass the widget name and a collection of pages to display when you call the method. 


4D View Pro

4D formulas in spreadsheets

The VP SET CUSTOM FUNCTIONS command lets you create custom functions in 4D View Pro to execute a 4D formula. It’s not necessary to create a method to use a simple variable in 4D View Pro, just pass it as a parameter to your Formula. Additionally, the command simplifies type-ahead for the end-user by providing help text and parameter names. In large structures, this command is much faster than using the generic SET FIELD TITLES command.


Want to know more? Read all blog posts about 4D v18 R5