What’s new in 4D v20

This document compiles all the new features available in 4D v20. Note that each feature has a related blog post to walk you through concrete examples. These blog posts can be accessed by clicking the feature’s title.

Also, sections with the blank tag are related to all the new features released between 4D v19 R8 and 4D v20.

This document is divided into six sections:

Improved network communication

Meet QUIC blank

As the number of simultaneous connections to the biggest production servers running on 4D continues to grow, ensuring optimal performance has become a top priority for development teams. The QUIC protocol has emerged as a promising solution to address this challenge.

QUIC is a protocol designed to enhance speed and performance in server-side networks. Developed by Google over the last decade, QUIC leverages the benefits of UDP instead of TCP to enable faster recovery in case of packet loss, congestion, and other issues. QUIC is today heavily used, for example, in HTTP/3 as “HTTP over QUIC” and supported by all major browsers, already used in more than half of all connections to Google’s servers. Facebook handles more than 75% of its internet traffic using QUIC, and many apps, such as YouTube, Gmail, or Uber, are using QUIC to communicate with their servers.

We encourage you to try QUIC and provide us with your feedback to help us improve and refine this exciting new technology, paving the way for its inclusion in future releases of 4Dv20. And keep in mind that QUIC can improve the resilience of the 4D infrastructure, making it better equipped to handle bad connections and other network challenges.

4D Language & Other Programming Features

Built-in Websocket Server blank

WebSocket protocol provides a persistent, full-duplex communication channel between a client and a server. It enables real-time data transfer between the two parties and allows faster and more efficient communication.

4D v20 now includes a built-in WebSocket server, allowing developers to build real-time web applications that can handle large volumes of data and provide a seamless user experience.

This opens up a world of possibilities for real-time data visualization, collaborative applications, and IoT applications that require instant updates.

 

Object and collection literal initializer blank

Objects and collections can be initialized in your code using New object and New collection commands.

4D v20 introduced a new and more readable syntax to initializing large or complex objects and collections in your code – the object literal and collection literal.

With object literals, you can initialize an object with its properties and values enclosed in curly braces {}. For example, instead of using the New object command, you can create a new object and initialize its properties in a single line of code like this $object1 := {a : “foo”; b : 42+26; c : {}; d : [“coucou”; “rien”]}.

Similarly, with collection literals, you can initialize a collection with its elements enclosed in square brackets [].

 

New commands to lock the datastore blank

4D provides you with multiple built-in ways to back up your data: 4D backup and the use of a mirror server. With 4D v20, 4D exposes internal commands to lock the datastore, allowing you to copy your data while 4D is running. Say hello to ds.flushAndLock(), ds.locked(), and ds.unlock().

Declaring Class Properties blank

4Dv20 brings you a new feature that will ease the use of your classes: declared class properties. Declaring your class properties will significantly improve autocomplete and give you meaningful errors when compiling. Declaring a class property is easy; it uses the same syntax as declaring variables but with the keyword property: property myProperty : text.

 

Automatic integration of multiple journals blank

4D v20 introduces a powerful new feature that can greatly improve your productivity during database maintenance operations. You can focus on developing your application by automatically integrating multiple journals at database startup rather than spending time on manual database management tasks.

To take advantage of this feature, simply ensure that the “Integrate last logs if the database is incomplete” setting is activated, which is the default. Then, place the journal files you wish to integrate next to the current one. 4D will automatically detect any missing operations in the startup database and check all journal files to determine if recovery is possible. If there are no problems, it will integrate the operations from all of the journals without any intervention required on your part.

 

Build an application with 4D commands blank

4D has continuously added new features to help developers create their own build chain, providing greater flexibility and customization options for their applications. These features include the ability to create a “.zip” folder, add additional information such as the copyright on an executable or a “dll”, and create an “info.plist” file.

With the release of 4D v20, two new features have been added to make the process of creating standalone or client/server applications even easier:

  1. Adding an Icon to an Executable.
  2. Generation of Deployment License File.

 

A tool for 4D code execution in CLI blank

4D v20 brings a new application called tool4d. This application is a subset of 4D designed for your build chain to automate the build process and is dedicated to headless script execution through Command Line Interface. But it also provides the LSP server, which is in communication with the VS Code extension.

 

4D-Analyzer extension blank

This extension got much attention from our 4D developers, and we couldn’t be happier!

4D brought Visual Studio Code code editor support, allowing it to handle 4D code and provide it with standard functionalities such as syntax highlightingGo To Definition, Signature Help, and code completion.

4D v20 brings new capabilities to the Visual Studio Code editor through the 4D-Analyzer extension: Say hello to code folding & indentation, and syntax checking.

 

Meet the Improved Distinct Function blank

The distinct function of the Collection and Entity selection classes allows retrieving a list of unique values.

With 4D v20, you can also retrieve the number of occurrences of each distinct value. Additionally, it allows retrieving all attributes path used in an object field. This functionality can be beneficial when working with large datasets and needing to analyze the frequency of specific values.

Comparison with an Undefined Value blank

With the introduction of ORDA and other objects in 4D, developers often work with undefined values, sometimes leading to errors when comparing them with different values.

Starting with 4D v20, a new improvement was introduced that allows developers to compare any type of value with an undefined value without throwing an error. This means you can now safely compare undefined values with others without worrying about causing an error in your code.

Introducing the Latest Find and Replace Features blank

The “Find and Replace” feature in the code editor has existed for many years. Developers can quickly and efficiently search and replace code, especially when dealing with large codebases. 4D v20 is bringing improvements that are sure to be appreciated by developers who rely on this functionality to streamline their coding workflows:

  • knowing the number of occurrences to replace,
  • knowing the position of the current occurrence,
  • having permanent access to the Next and Previous navigation options,
  • display a palette instead of a modal window to limit the number of clicks.

 

Passing form object to Print Form and FORM LOAD commandsblank

With 4D v20, the Form command is supported with Print form and FORM LOAD. Form, with previous versions available for DIALOG or subforms, allows drastically reducing the need for process variables and writing more portable and isolated code. This a welcome improvement to 4D that will undoubtedly make developers’ lives easier and more productive.

 

Create your own Help Menu blank

With 4D v20, you can create a custom “Help” menu for your application by passing a collection describing the menu items. This, for instance, allows you to provide your users with easy access to documentation, support, and other helpful resources.

 

New handy functions for collections  blank

4Dv20 provides a set of functions to manipulate collections. Besides the over 40 methods we already provided in the previous version, this release gives you:

  • first() and last(), as their names indicate, allow access to the first and the last element of a collection.
  • The at() function is also an alternative to square brackets (col[x]) with a benefit; the value can be negative to get the items from the end.
  • The flat() function is more innovative and will be very useful in some cases. It allows the flattening of collections that can contain collections (that can also include collections, etc.).
  • The includes() function is handy because it allows knowing if a collection contains this or that element of almost any type… text, numeric, date… and even references of objects or collections.
  • The new reduceRight() that is the optimized equivalent of reverse().reduce()
  • The flatMap() function allows us to perform, in a single operation, a map() followed by a flat() – a function that we mentioned before.

 

PDF format for Print Previewing on Windows blank

PDF format has now become a viable alternative to XPS for print previewing on Windows, providing users with a new and more accessible option. Microsoft’s decision to make the XPS Viewer an optional Windows feature has caused issues for many users when deploying applications, resulting in end-users being unable to preview their printings. Although installing the free XPS Viewer is a straightforward process, some administrators are hesitant to install additional features, particularly on Remote Desktop environments.
Fortunately, 4D v20 now offers the option of using the PDF format for print previewing. Since almost all current Windows versions have either XPS or PDF pre-installed, end-users should no longer encounter issues with print previewing. This new option offers a more flexible and efficient solution that meets the needs of both end-users and administrators.

 

Return. Continue. Break. And more

We listened to and followed your feature requests in 4D Forum with several 4D language improvements!

  • Starting with statements that allow you to jump out of a block of code:
    • The return keyword terminates the execution of the method or function in which it appears and returns control to the calling method. It can also return an optional value.
    • The break keyword terminates the loop containing it. The following statement executed is the one immediately after the loop’s body.
    • The continue statement terminates the statements’ execution in the current loop’s current iteration and continues the execution of the loop with the next iteration.
  • Followed by short-circuit evaluation: In an expression that uses an AND or OR operator, a short-circuit evaluation means that the second argument is executed or evaluated only if the first argument does not suffice to determine the value of the expression. We add two new operators to do it:
    • && for the AND operator
    • || for the OR operator
  • And then there is a ternary operator, which is a condition followed by a question mark ( ? ), an expression to evaluate if the condition is truthy followed by a colon (:), and finally, the expression to evaluate if the condition is false: condition? value If True: value If False.

 

Error Handling

4D v20 is bringing new possibilities to error handling. From now on, you can define a global error handler that will be efficient for all execution contexts (processes, workers, ORDA computed attributes, ORDA functions, etc.). If you miss defining a local error handler in a new process/worker, the global error handler will be invoked automatically. This means no more error dialog displayed on the server or uncaught errors.

Visualize your classes components in the method explorer

4D already allows applications still running in binary mode to take advantage of class features by using a component (in project mode) to create and use your own classes from your (binary mode-based) application. This feature included tips and code completion support to smooth your code writing.

To make your coding experience even easier, 4D v20 is bringing a new feature. From now on, you can visualize a list of all the available component classes in the method explorer, so you decide in a glimpse of an eye which functions you need to use in your code.

 

Support of larger integers than integer32

So you need larger numbers than 2 Billion (32 bits) with high accuracy for counters or similar? We enhanced reals and the way they’re handled to allow that. While reals are known to be imprecise, they are 100% accurate even for very large numbers, as long as they do not use a decimal point (=integers). This lets you use numbers up to 53 bits, or more exactly, [-(2^53)+1, (2^53)-1]. So a range from −9,007,199,254,740,992 to 9,007,199,254,740,992 will be exactly represented.

Converting to or from the text was limited to using 12-digit scientific notation, resulting in a loss of precision. With 4D v20, we have improved the accuracy and conversion of any Real number (presenting an integer) into a Text. The improvement of the conversion to string concerns the String() command and the JSON and XML commands returning numbers in string form.

 

Support of Formulas in Collections & Callback Commands

To give a simpler way to use collections with a member method that needs a callback method, 4D allows you to use a formula to define a callback in:

 

Allow components to publish classes

Suppose your application is still running in binary mode. In that case, this feature will enable you to benefit from classes and object-oriented development by using a component (in project mode) to create and use your own classes from your (binary mode-based) application. So starting with 4D v20, a new Component section is added to Structure settings -› General allowing you to configure how your component classes and functions will be exposed in the 4D method editor once the component is installed.

 

Forward parameters from a function or method to another

With 4D v20, developers don’t have to handle complex parameter checks (count parameters, value types) when calling a function and passing parameters.

A new command is provided, Copy parameters, allowing to easily pass parameters used for a function or method call to another function/method. This results in lighter, more elegant, and easier-to-read code. 

 

Form and subform communication

Starting with 4D v20, associating a variable with a subform has enriched the possibilities of interfaces and communication between forms and subforms. The means of communication are now simplified by two new commands: OBJECT Get subform container value and OBJECT SET SUBFORM CONTAINER VALUE

 

New command to get detailed information about licenses

4D v20 is shipped with a new command that gives all the information about your license usage: Get License Usage. We have also expanded our diagnostic logs. Thanks to getting this feature, you’ll be able to follow the license consumption on your server, optimize your usage and plan ahead for your future needs.

 

More options for OBJECT SET enterable command

The OBJECT SET ENTERABLE command has been enhanced, enabling you to better manage a field that is not editable. As a third parameter, the command supports a boolean or an integer. 

  • So, you can use the command as before without changing your code by passing a boolean. Only the enterable property is modified (False or True).
  • Or you can pass an integer. Thus, you can set the enterable and focusable property for your field.

 

Accessing method parameters that don’t exist

4D v20 allows access to all the method parameters without error, even if some were not passed by a caller. The code is more straightforward and readable without the repeated “if” keyword.

 

Create a blob attribute in an object

With the introduction of classes, the need for storing data in objects has increased, especially data in the form of blobs. For this reason, 4D v20 supports the encapsulation of blobs in objects.

Beyond the storage aspect, since the blob object is a reference type, your memory usage will be lower, and your speed performance will be greatly enhanced.

 

Byte Order Mark (BOM) and End of Line (EOL) management

4D has evolved smoothly to follow best practices regarding managing certain invisible characters in text files. That’s why from now on, 4D writes text files without a BOM. And on macOS, 4D uses LF as an EOL character. This is completely automatic for all files written by 4D, such as 4DSettings, 4dm, 4DForm, etc.

As for compatibility settings, new options are available allowing TEXT TO DOCUMENT and File.setText() to generate files without a BOM and use LF as an EOL character on macOS when the optional “charSet” and “breakMode” parameters are missing. For more details, check out the documentation.

 

Default .gitignore file in new projects

Project mode allows you to easily track changes with Git (version control system), but often you don’t want to track your project files in the Git repository. 4D v20 lets you define what not to track in a new project by automatically adding a default .gitignore file in the project folder with a list of default files and folders to exclude.

 

Automatic components Signing on Mac

With 4D v20 and on Mac, 4D automatically signs built components using the certificates defined by the user or an Adhoc signature if no certificate is specified. This allows component developers to distribute signed components so end users don’t have to sign them before using them.

 

Show online documentation directly from the code editor

You can access the details of a class function without having to search on the documentation site. Simply press the F1 key or click the Goto definition… item in the contextual menu.

 

Emails 

POP3: Download the Mail Header Onlyblank

When retrieving email messages using POP3, it’s possible to retrieve just the message headers (which include information such as the sender, subject, and date) without downloading the entire message body.

Retrieving just the message headers can be helpful when you want to quickly scan the list of messages in your mailbox to decide which ones to download and read in full.

Starting with 4D v20, a new parameter is added to the POP3Transporter.getMail() function to receive your emails without the body. 

 

IMAP: Mailbox Id and mail keywordsblank

4D v20 brings two handy features to IMAP Transporters:

The first feature is the ability to manage custom email keywords when interacting with specific IMAP mail servers and clients. Custom keywords allow you to tag emails with particular labels or categories, making it easier to organize and find them later. With this new feature in 4D v20, you can add, remove, or list custom email keywords using the IMAP Transporter.

The second feature is mailbox ID support in the IMAP Transporter. When you work with IMAP mailboxes, they can be renamed or moved, making tracking difficult over time. With the mailbox ID support in 4D v20, you can identify a specific mailbox even if it has been renamed or moved. This can be useful for keeping track of essential mailboxes, such as ones that contain archived messages or messages from specific senders.

 

Microsoft 365 native support

As more customers move to Microsoft 365 for their email needs, 4D v20 offers a solution to simplify email management.

The latest automation features allow for easy automation of Microsoft 365 email operations using built-in commands. These operations include:

  • send, receive emails, and list your mailbox folders
  • move an email from one folder to another,
  • reply to an email and create a conversation,
  • create a draft email and save it in the folder of your choice,
  • and delete an email.

 

Microsoft365: folders management blank

Microsoft is deprecating Basic authentication for IMAP and POP3, which means that users will need to use a more secure authentication method to access their email data. The Graph API is a more secure and modern way to access data in Microsoft 365, including email data.

With the new functions in 4D NetKit, you can now manage (create, delete, rename, and get information) by programming your mailboxes using the Microsoft Graph API.

 

Get user information from Azure

Besides providing access to Office applications, Microsoft provides an Azure-based Active Directory, allowing users to log in to access services such as Microsoft Sharepoint or OneDrive using a Web Browser. All Microsoft services use the same Single Sign-On, based on the email address. From 4D v20, 4D NetKit allows you to be part of this concept, enabling users to log in to your application using their usual company credentials.

Besides allowing Single Sign-On, it will enable retrieving information on an authenticated user, such as email, department, and phone number. If the administrator permits, you can retrieve details about the user’s colleagues within the same company.

 

Bcrypt support for passwords

Starting with 4D v20, all passwords are hashed with the bcrypt algorithm. An algorithm takes much longer to compute, enough to prevent brute-force algorithms from recovering the original password.
To put it in place, everything is automatic. You don’t need to touch any setting or any line of code. When the password is changed in the toolbox or using the CHANGE PASSWORD or Set user properties commands, the bcrypt hash is stored. And during authentication, 4D recognizes automatically if the password is stored with legacy or bcrypt hash so that users continue to connect without changing their password. 

 

HTTP client improvements

To continue improving the syntax and functionality of 4D, we have decided to modernize the HTTP client commands in 4D. 4D v20 brought a new way to perform HTTP requests: HTTP classes. Plus, some HTTP class functionalities, including compressed responses, chunked responses, and redirections.

 

Code Editor

Quickly jump to different functions of a class

Classes are composed of several functions of varying lengths. So it is not always easy to find the function to modify or move from one function to another. It is possible to use explorer, which displays the classes and functions, but when you are coding in the editor window, you don’t want to waste time changing windows.

With 4D v20, the list of functions in your class is displayed in the code editor toolbar, allowing you to quickly jump to a specific function. 

Comment Tags

4D v20 takes comments to a new level with comment tags to better organize your comments. Tags are used to classify comments by simply putting the tag at the beginning of the comment line. We have put three tags at your disposal:

  • MARK
  • TODO
  • FIXME

The MARK tag allows you to split your code into sections. You can write it in three different ways. The other two tags TODO and FIXME, are written similarly. The interest is that they have different icons in the list, which allows you to organize your code to prioritize your future actions.

Object Check Syntax 

Auto-completion simplifies code writing and limits errors in function names. But it doesn’t avoid them entirely; it’s easy to reverse two letters, to forget a capital letter. And then spend time looking for why your code doesn’t work. So what better way than to ask 4D to check if the classes or functions already exist? Starting with 4D v20, a warning is displayed in the code editor if you call a function that does not exist.

Code Editor Customization

In addition to customizing the window and the code area, 4D v20 brings two new customization options:

  • Show or hide the ten clipboards. 
  • The “show/hide lists” icon has been moved to the bottom right next to the lists.

 

Simplified navigation between code, documentation, and explorer

When creating a form or writing a new function or method, you usually need to:

  • access the explorer to fill the form in its folder
  • access the explorer to write the documentation for the method
  • to see the documentation of a command on the 4D online site
  • to see the documentation of a method of a component
  • access the code of the function we want to use in our method to make some modifications
  • navigate easily between the different functions of a class

In 4D v20, we’ve added menu items and a new list in the code editor, allowing you to better navigate a project’s different elements.

 

Show online documentation directly from the code editor

With 4D v20, you can access the details of a class function without having to search on the documentation site. Simply press the F1 key or click the Goto definition… item in the contextual menu.

 

Web 

Debugging on the server with scalable web sessions

Scalable web sessions were a significant improvement. They allow you to use 4D tags, 4D actions, and the REST API in preemptive processes, even in interpreted mode, on a 4D server. However, for debugging, you needed to open your development environment on the server to make it switch to cooperative mode, as the debugger window cannot be opened with preemptive processes. Starting with 4D v20, we simplified debugging on the server side by simply attaching the debugger to it.

 

New Windows System Rendering Engine

Starting with 4D v20, if you use the system rendering engine, 4D uses Microsoft Edge WebView2. This change allows you to benefit from a modern browser with the latest features and security updates. For example, Microsoft Edge can be used to display PDFs.

 

Files & Folders

File Handles

When it comes to writing and reading, the setText and getText functions are at your disposal to read or write the entire content. 4D v20 brings file handles in case you want to read or add one or more lines to an existing document.

File handles are objects created based on “File” objects and have functions to access any part of documents and, from there, to read or write their content sequentially.

SUPPORT OF LZMA, THE NEW COMPRESSION ALGORITHM

With 4D V20, the Zip Create Archive command supports a new compression algorithm: LZMA. The advantage of this algorithm is that it creates smaller archives than the standard zip compression algorithm. You can pass a “zipArchive” object to the command to customize your zip. This allows you to choose the compression algorithm, the encryption algorithm, and other options.

 

Listbox

Automatic Row Heights in Collection Based List Boxes

Automatic row heights were already possible for array-based list boxes, allowing them to automatically adapt the height of each row to its content. 4D v20 is bringing this possibility to list boxes based on collections and entity selections.

 

Say Goodbye to the ALT key

Regarding list boxes and the Drag and Drop action, starting with 4D v20, there is no need to hold the Alt key to move several items simultaneously.

 

Horizontal & Vertical Cell Padding

The power of list boxes is extended with 4D v20 thanks to two new properties: horizontal and vertical padding (the inner margins or the space between an element’s content and its border). They will give your list boxes new presentation possibilities, and your interface will have an even more professional look.

These properties can be set globally for the whole list box or for each element, like columns, headers, or footers. Once defined for the list box, they will be applied to every sub-object of the list box by inheritance. But of course, each sub-object can have its own settings.

Setting the padding can be done either:

  • via design mode from the list of properties under “Coordinates and sizing.”
  • or by programming using the LISTBOX SET PROPERTY command thanks to two new constants, lk cell horizontal padding, and lk cell vertical padding.

 

Developing concurrently on 4D Server in project mode

If you are one of the developers who asked for the possibility to work simultaneously with teammates on a single development server, then 4D v20 will grant you your wish, thanks to a new mode for connecting a 4D Client to a 4D Server: development mode.

Developers can modify the database structure, methods, forms, and settings in development mode. We changed the locking system to provide the same functionality as in binary mode.

 

Test Windows SDI application

It’s been a long time since you could provide your customers with merged applications in SDI mode. That was a huge step forward for Windows applications UX.

4D v20 makes testing an SDI application easy: you can view the result of your application without the need to build your standalone or client application.

 

System Workers: Launch an external process asynchronously

Another highly requested feature is available for you. Sometimes, you need to run processes in the background and perform specific actions based on its output code as soon it is available while the process is still running. For example, to display a progress bar. 4D allows you to start a background process with the new 4D.SystemWorker class and automatically execute callback methods when the process returns information. So, if you use it with an interface, the interface stays responsive to your user while the external process is running, and when it is finished, you can display the result to your client.

 

Reorganization of the Diagnostic Logs

Diagnostic logs have become more and more critical for troubleshooting. We’ve reorganized them entirely by improving their content and adding a way to filter content (log levels such as trace, debug, info, warn, and error). Thanks to the new database parameter Diagnostic log level, you can control the flow of logs in the diagnostic log and keep it small while logging what you really need.

 

Configuration File for Loggin 

As part of our logs enhancement project, 4D adds two new functionalities:

    • the ability to instantly pause logging
    • and a way for support teams to quickly help their customers configure their logs through a configuration file
 

User Interface

Evolution of Form Objectsblank

To allow you to make the most beautiful interfaces, new possibilities are available:

  • For buttons, radio buttons, and checkboxes, we have added new settings for the text and the icon. “Text alignment” property and the new “Image hugs title”.
  • For radio buttons and checkboxes, the number of states for the icon has been improved (True, False, Rollover, and Disable) to allow a better rendering for the end user.

 

Round Corners

Also, 4D v20 added the possibility to round the corners of static texts and input texts thanks to the new “Corner radius” attribute. Specifying its value can be done via the UI (the property list), CSS, or code.

 

High DPI on Windows: Support for high-resolution screens

High DPI stands for High Dots Per Inch. It represents the pixel density; the higher the DPI, the higher the density of pixels. On 4K screens, the pixel density can be so high that displaying, as usual, would make all icons and controls extremely small. As such, Windows allows you to change the text, icons, and control scale. On 4K screens, it’s activated by default. We first supported high DPI on Mac and is now fully compatible with Windows, too. The result is better text and image quality.

 

Developing with 4D in a dark environment on macOS

Since 4D v19, you can create applications on macOS that support dark mode, so you can please your users by allowing them to choose light or dark-style applications. With 4D v20, we are providing you, as a developer, the choice when developing your application. 4D Developer Edition integrates seamlessly with the light or dark look of macOS.

 

Structure Editor Toolbar Optimization

The toolbar has been modified to modernize and standardize all 4D windows.

When hovering over tables, fields, or relationships, helpful information is displayed in the status bar. New in 4D v20 is the display of relationship names directly in the status bar. You no longer need to open the properties window. 

 

Data Explorer

The 4D Data Explorer is a web browser interface usable by the administrator and the developer remotely (securely with an HTTPS connection) or locally on the same machine as your opened database.

With 4D v20, the Data Explorer now offers two major enhancements.

Visualize the relations between your data

The first feature allows you to visualize the relations between your data, making browsing and locating relevant information within your database easy.

Data Explorer embedded in 4Dblank

The second update is the addition of an icon for the Data Explorer in the toolbar, making it even easier to open it in 4D instead of an external web browser. Users can access the Data Explorer directly from the toolbar with just one click, saving time and improving productivity.

 

 

Deployment

USE DUPLICATED MERGED CLIENT APPLICATIONS

As a software publisher, some of your customers sometimes have many instances of your merged server application, for example, a merged server application for each group company. In this kind of deployment architecture, your customer’s officers often ask you to install a merged client application for each merged server application on their computer because they want to use the software for each company. From now on, you have a new buildApp key at your disposal to make each duplicated merged client application use its own user preferences folder (based on its application path): ClientUserPreferencesFolderByPath.

 

Directory file management in merged server projects

On the server side, the current user is always the Designer; therefore, access to runtime explorer is always allowed. If you prefer to change this behavior, 4D v20 enables you to restrict administrators from accessing the Data Explorer and Runtime Explorer in your deployed merged servers.

 

Reduce the size of client applications & more

4D v20 brings many enhancements to 4D applications’ building. For starters, you can remove unnecessary libraries (such as CEF/Web Area, PHP, Mecab, and 4D Updater) to reduce the size of your applications. We also changed the final directory when you build a compiled structure to accommodate those using multiple compiled versions of the same structure. And for our Japanese customers, we have merged the Japanese version of 4D and the international one on macOS.

 

Simplified cross-platform client/server applications building on Windows

With the introduction of Silicon, building cross-platform client/server applications has changed. As long as you build your server on Mac, it’s not much of an issue, as you can compile for both Intel and Silicon platforms. But on Windows, it’s not possible to compile for Silicon Macs. 4D v20  introduces a new feature that reduces the number of files to transfer from your Mac to your Windows machine. 4D will also generate a Compiled Database directory when building the client on Mac. This folder contains only the compiled code for your application and is, as such, relatively small.

 

CI/CD: Build your Compiled Structure or Component with Build4D 

With the introduction of the project mode, it’s pretty easy to manipulate the components of your projects. In the last few feature releases, we have added several functionalities allowing you to create your own build chain adapted to your team, working methods, and needs.

To help you create your own build chain or integrate 4D into a continuous integration tool, we have developed a component named Build4D, available on GitHub with the sources. For this first step, Build4D allows you to create a compiled structure and a component. We will continue to enrich it to enable you to manage a single-user, client, or server application.

 

Share local resources between users ON Windows Remote Desktop Services

If you were one of the developers who asked for a feature that allows downloading Local Resources to a shared folder with the Windows Remote Desktop Services instead of the user account folder, then 4D v20 is bringing good news.

We got some optimization by rethinking the current architecture by developing a new option for projects in the BuildApp process to allow Local Resources mutualization.

It’s activated by this new BuildApp XML key: /Preferences4D/BuildApp/CS/ShareLocalResourcesOnWindowsClient

This optimization results in the following:

  • A time gain because Local Resources are no longer downloaded from the server by each user,
  • And disk space gain since, again, Local Resources are not duplicated for each user in a Remote Desktop Service environment.

ORDA

4D v20 continues to bring enhancements to ORDA. Object Relational Data Access is an innovative way of accessing data that combines the advantages of object-oriented programming with those of relational databases, allowing developers to focus on solving business problems rather than managing data access. 

4D v20 brings: 

Users permissions management (REST Server) 

In addition to the ability to expose or not expose a dataclass and some of its attributes as a REST resource — which was a convenient way to restrict access to your data, 4D goes a step further to deliver a powerful and fully customizable system to protect your data from unauthorized users. A system to protect your data depends on who is accessing it and which data is accessed.

This new feature is based on ORDA concepts and scalable web sessions. It covers all web processes, such as REST requests, requests received on a remote datastore, and web processes like 4DACTION or 4D tags.

 

Optimization of performance with complete control over REST requests 

4D v20 gives you better control over the ORDA contexts and cache for both Client/Server and REST to improve performance.

 

Computed attributes

A new way to gather even more of your business logic in Classes and ORDA classes! The times when you had to define business-related formulas in your 4D UI (such as string concatenations or VAT computation) are over. You can now define complex calculations directly in your Classes and use the result like you would for any other structure field in Rest API, your mobile application, or your ORDA-based user interface, for instance. 

 

ORDA Aliases 

4D v20 is shipped with a new ORDA concept: Aliases. They are the logical and complementary continuation of computed attributes. As the name suggests, an alias is, in fact, a shortcut to an existing datastore object. They are defined in the “entity dataclass” like computed attributes. While a  computed attribute can process any calculation or formula, an alias is just a shortcut, making development faster and easier. An example usage is to give easy access to related attributes (which means hiding the complexity of a related database). 

 

Disable default mapping of NULL value to a blank value

When you create a new field in your database, 4D allows you to choose or not to map NULL values to blank values. Starting from 4D v20, in new projects, 4D will no longer, by default, map the NULL value to absent data. This is beneficial because ORDA is perfectly designed to work with NULL values and will spare you many inelegant workarounds.

 

Pessimistic Lock management VIA RestModel update

With 4D v20, you can use the REST API to lock or unlock an entity. This is particularly useful to:

  • Keep your code consistent if you are used to working with the REST API. There is no need to write a function in ORDA Data Model Classes to lock/unlock an entity.
  • Smoothly use the pessimistic locks with the REST API.

 

Full support of BLOB 

Starting with 4D v20, Blobs are fully supported in ORDA, like any other type, allowing ORDA developers to use the ORDA syntax to save a Blob in a database. 

 

Compare two entity selections

You need robust and optimized functions to work efficiently with object-oriented programming and write as few lines of code as possible. That’s why, with 4D v20, we’re shipping a new function available on the entitySelection object: the selected() function. Thanks to it, you can inspect and compare two entity selections.

 

4D Write Pro

 

4D Write Pro has dramatically improved over the last few versions. In fact, we, the 4D team, are invested in making 4D Write Pro a potent template-based document generator, eliminating the need for manual document creation and reducing the risk of errors.

With 4D Write Pro, you can automatically feed and generate pre-filled documents with contextual information, pulling data directly from the 4D database. This includes information such as names, dates, address information, and numbers, among other types of data. 4D Write Pro then merges this information with your templates, providing a streamlined and efficient document creation process.

4D v20 introduces powerful features such as headers, datasources, and carry-over rows, to name just a few.  Whether you are a business professional or a developer, you will find these features to be extremely useful in improving your workflow and productivity.

 

4D Write Pro & Text Boxes: docx Import/Export Optionsblank

Text boxes allow you to insert a floating container, including text, tables, images, formulas, and other elements anywhere in your document. This feature has been improved in v20 to include exporting and importing these elements from and to docx documents.

 

Define data contexts

4D v20 opens the world of ORDA and object-oriented development to 4D Write Pro documents. 4D Write Pro documents often contain formulas returning data or calculations depending on the database. Thanks to contexts, associating that data with documents is as straightforward as using the This keyword. A perfect way to create templates and personalized documents with 4D Write Pro.

 

Dynamically fill tables with entity selections & collections

Manually filling the tables with data every time is a laborious task. And that’s where data context comes as an invaluable option, opening the world of ORDA and object-oriented development to 4D Write Pro templates.

It is now possible to define a “datasource” for the tables of 4D Write Pro. Whether it is an entity selection or a collection, this “datasource” will automatically feed the rows of these tables. The tables will automatically be enlarged based on the selection, even adding additional pages when needed. This allows the end-user of your application to design or modify templates that will be filled automatically with data.

 

Bottom Carry-Over Rows (subtotals)

Imagine having a big sales table potentially spanning several pages. At the end of one page, you’d like to calculate the subtotal, carry it over to the next page, and include it on the calculations on that page. This is often necessary, sometimes even legally required, when editing long invoices, for example.

4D v20 allows inserting a “subtotal” line at the bottom of each part of the respective tables that can be filled automatically.

This can be done either:

  • Via both interfaces (toolbar and sidebar). The table menu contains a new item, “Bottom carry over row.”
  • Or by programming, thanks to the new attribute wk bottom carry over row.

And to define the content of the cells in this carry-over row, the new attribute previousItems can be used with all available functions (min/max/sum/etc.) for collections or entity selections.

 

Tables’ Break Rowsblank

When you have a list of data, for example, a list of people with their continents, countries, and cities, you may want to group them by continent, then by country, and then by city. This will make it easier to understand and analyze the data.

When a table is populated with data from a sorted data source, 4D Write Pro can insert a break row whenever the value of the sorting criteria changes. This allows the user to group the data according to their desired criteria.

In another scenario, this feature can also be used to create reports based on company relations, where a list of employees can be grouped by the company on each continent. By specifying the appropriate sorting criteria, 4D Write Pro can create separate groups for each company on each continent.

 

4D v20 is shipped with new attributes to define the tables’ layout better. Enabling you to create complex 4D Write Pro documents with ease, but most importantly, visually appealing documents: say hello to page breaks inside table rows. This is useful when the cells have longer text (or several paragraphs). It may be interesting to define that a cell (and therefore a line of the table) can also be split in two to fill the available space on the pages of the documents:

  • wk page break inside paragraph can, of course, be applied to paragraphs, but also to any target such as the document itself, a particular section, a range of text, etc. In all cases, the attribute will be assigned to the paragraphs inside the target. This is simply a programming facility.
  • wk page break inside table allows a table to be split into two (or more) parts, the separation is done between two lines of the table (as usual)
     
  • wk page break inside row also allows to split a table, but this time inside rows. Note that this option is dependent on the previous one. If a table cannot be split, neither can its rows.

 

Please note that the page break inside table rows option is available in the toolbar and sidebar widgets.

 

Table headers 

This feature brings another useful table display option, available by programming or through the 4D Write Pro interface widgets. Starting with 4D v20, you can define headers in tables and automatically repeat them after a column or page breaks. 

 

Document change Detection

When a 4D Write Pro document is in edit mode, it’s often helpful to know if it has actually been modified by the end user. This information allows actions or interfaces to be adjusted for a more user-friendly experience.

The new document.modified property allows 4D Developers to detect changes inside a document and perform actions accordingly. Either transparently (making automatic saves when a document remains open, for example) or modifying their interface intelligently according to conditions.

 

User-friendly Display of Formulas

Everyone loves formulas; they are integral to 4D Write Pro documents. They allow the integration of a lot of information coming from the database, making document creation more intuitive and automatic.

However, some formulas can sometimes be long from a layout point of view and hard to read for end-users.

That’s why 4D v20 allows you to display formulas as a symbol ⓕ, indicating their presence to make documents more precise and transparent.

This can be done:

  • Via the property list, thanks to the new “Display formula source as a symbol” property.
  • A new element in the interface.
  • Or via programming thanks to the new wk display formula as symbol attribute.

 

 

Disable Visibility of Empty Images

4D Write Pro documents can contain images from different sources and in various formats. These images may, in some cases, not be displayed for totally reasonable reasons — such as invalid URLs, formulas returning empty images, formats not supported by the platform, etc.

However, they are always represented by a small empty rectangle showing their theoretical location. 4D v20 is shipped with a new view option enabling you to make empty images completely invisible. This can be done in 3 different ways:

    • The first and most straightforward way is to use the property list, which offers a new entry in the appearance theme. 
    • Or via the user interface in which a new element appears. Either in the toolbar or in the sidebar.
    • Or by programming using the new wk visible empty images parameter.

 

 

New image display options

Starting with 4D v20, inline as well as anchored images inside 4D Write Pro documents benefit from seven new formatting types thanks to the new wk image display mode attribute:

  • Scaled to fit (by default)
  • Truncated
  • Truncated centered
  • Proportional
  • Proportional centered
  • Replicated
  • Replicated centered

We’ve also made it easier to format the images used as background documents, sections, paragraphs, etc., thanks to the new attribute: wk background display mode.

Formula visibility management

Several display options are already available for 4D Write Pro documents. We’ve added the wk formula highlight option to the list, with 4 possible values:

  • 0: no highlighting of formulas and values
  • 1: highlight formulas only (default value)
  • 2: highlight values only
  • 3: highlight formulas and values

It can also be done using standard actions. They can be used with checkboxes, standard buttons, and dropdown lists.

 

Linked paragraphs

To have better control over the document’s layout, 4D v20 is shipped with the possibility to choose if a paragraph and the one that follows must remain linked (not separated by an automatic page or column break).

 

Export TO SVG format

4D Write Pro documents can already be exported into different formats: pdf, plain text, Microsoft Word, HTML… To this list is now added the SVG format. This allows, for instance, to create a picture of the first page for a fast preview, usable on both platforms and in a browser or mobile device, or insert a 4D Write Pro block inside another document, such as a 4D View Pro document.

SVG being an image format, you can choose which page of your document you want to export. The final image will be based on the page rendering of your document. It will consider all the layout options, such as orientation, margins, etc.

Interface widgets improvements

4D v20 brings a set of features to the interface widgets:

  • We have added a menu to insert formulas in both interfaces.
  • We’ve also added several attributes of paragraphs for better respect of typography rules, to have a more readable and more aesthetic document, such as:
    • Widow and orphan control
    • Avoid page breaks inside
    • Keep with next 
    • Line height
  • In the sidebar widget, you can now manage page breaks, section breaks, columns, and view parameters like orientation, format, type (draft, page, or embedded), or visibility of some elements (invisible character, header, footer).
  • As for the toolbar widget, we’ve added the possibility to fill in the fields, title, author, subject, company, and notes.

 

Dark mode support

You can ultimately develop and deploy in light or dark mode on macOS. The last widgets of the library are compatible with dark mode (on macOS):

  • 4D Write Pro Interface toolbar
  • 4D Write Pro Interface
  • Sidebar Rich text area

 

Image setting dialog

The 4D Write Pro interface component now includes a new Picture Settings dialog. This allows you to easily define:

  • the size of the image
  • the display format
  • margins and padding
  • the position on the page for anchored images

 

The dialog can be displayed either from the contextual menu or from an event such as “on double click” on the form using the “WP PictureSettings” component method. 

This feature release also allows adding an image from a URL with the toolbar widget.

 

Continuous section breaks

Starting with 4D v20, 4D Write Pro supports continuous section breaks. A continuous section break creates a section in its own right but without causing a page break. This allows, among other things, to have different numbers of columns on the same page.

Inserting a continuous section break can be done:

  • By programming via the WP Insert break command, which now supports a new value: wk continuous section break
  • By using a menu with an associated standard action or by simply adding a standard action to a button
  • via the user interface

 

 4D View Pro
 

 

Whether it is for sales, finance, accounting, data analysis, or any other profession dealing with long and unwieldy datasets, 4D View Pro is the answer. It is a multilingual product with direct access to your 4D data that allows you to take full advantage of integrated, powerful spreadsheets. From the possibility of building graphically-advanced dashboards that no longer look like a spreadsheet to reports that can be created off-screen every morning and sent automatically to the management — 4D View Pro has everything you need to make meaningful business decisions. 

And with 4D v20, the product is more powerful than ever, with a set of features that will definitely find useful:

Pivot tables

4D v20 pivot tables. If your users include people from sales and marketing, this feature is worth a try, as it allows you to easily summarize and analyze data directly from the 4D View Pro ribbon.

 

CSV: New import/export format

4D v20 allows you to import and export CSV files. CSV is a common data exchange format widely supported by many applications. For example, you can display the data of a CSV file that comes from another information system using the VP Import document and the VP Export document. These commands support delimited text file formats such as CSV.

 

Sheet management

By programming, 4D v20 lets you manage the sheets in your 4D View Pro documents. You can create, rename, hide, or remove a sheet or simply check which sheet the user is currently on using the following commands:

  • VP SET SHEET COUNT: define at once the number of sheets you need
  • VP ADD SHEET: insert a sheet (with a custom name) at a specific index
  • VP SET SHEET NAME: guide your users by giving relevant names to your sheets
  • VP SET CURRENT SHEET: change the selected sheet 
  • VP SET SHEET OPTIONS: hide sheets, for example, those that contain only information for calculation

 

Manage page breaks FROM THE UI

With 4D v20, managing page breaks from the user interface is now possible thanks to new entries in the contextual menu: “Add page break” and “Remove page break.”  You can also show or hide the print lines using the new commands VP SET SHOW PRINT LINES and VP Get show print lines.

 

Workbook options

When you create a document with 4D View Pro, you often need to fine-tune your user experience by hiding the sheet tabs, the scrollbars, deactivating the context menu, or the drag and drop… All these features and more are possible with the VP SET WORKBOOK OPTIONS command.

Speed up your development process with templates

Creating reports or spreadsheets from existing templates speeds up development. Like an end-user using the Copy and Paste action, as a developer, you can, with 4D v20, simply “copy” a range of cells from another location or even another area. The VP MOVE CELLS command allows you to copy/cut and paste a range of cells in another location, even between two areas. Another way to copy a range is to copy it in an object with the VP Copy to object command, for example, to save it in your database, So you can paste this object when you need it with the VP PASTE FROM OBJECT command.

 

Print Interface 

To make it easier for your customers to set up printing, the Ribbon now has a new addition; it supports print settings with a “Page layout” tab and a “Page setup” dialog. This dialog includes tabs for Page, Margins, Header/Footer, and Sheet, allowing users to manage many options in the VP SET PRINT INFO command.

 

Populate your sheets with A data context

4D View Pro offers you a new way to load your data and create your templates: the data context. It allows you to create your document with placeholders and fill them by setting this data context

 

Display your Collections as Tables

4D View Pro already allows you to easily load and display data in spreadsheets. 4D v20 brings a new table feature that enables you to do much more and benefit from additional properties like headers, table resize, summary row, column sorting, filters, and more. This feature allows you also to quickly load data from data classes and collections. Say hello to the new VP CREATE TABLE command.

 

Manage rows and columns

4D v20 brings several new commands allowing you to manage your table columns and rows more efficiently — by adding or removing columns/rows depending on end-users’ needs.

Combining this new feature with data contexts enables you to design more advanced templates to automatically populate business content with the correct information for every situation — be it reports, invoices, contracts, or any other document type.

 

Tables style customization

Tables are an integral part of 4D View Pro documents. As such, we have provided many table-related advances over the different releases. 4D v20 adds a new feature related to styling those tables to fit perfectly with the rest of your document.

From now on, the VP Set table theme provides a way to apply by programming one of the over 60 predefined table styles. If none of these styles meet your need, you can define your own theme and apply it to your table.

 

 Feature releases in depth