What’s new in 4D v20 R3 – 4D Blog (2024)

4D Write Pro

Assign Names to Formulas

Previously, formulas could be displayed as values, expressions, or symbols, which might have posed challenges regarding readability.

However, with 4D v20 R3, developers now have the option to assign names to formulas. This improves the intuitiveness of 4D Write Pro documents since users can quickly identify and understand the purpose of each formula within the document, making it easier to work with templates and boosting the overall user experience.

Two commands, the WP Insert formulaand the WP Get formula, have been revised and improved to support this new formula display mode.

Learn more and find examples in the blog post >

export PDF/A format

The PDF format has become a classic choice for exporting 4D Write Pro documents and has been available in several versions. And starting with 4D v20 R3, there is an exciting addition: the PDF/A format. This new format is optional but opens up possibilities for future applications like electronic invoicing.

You can export 4D Write Pro documents in PDF/A format in the usual way, either through the interface or programmatically. Both methods are straightforward, and you can choose between the most recent formats, such as PDF/A-2 or PDF/A-3.

Learn more and find examples in the blog post >

Programming-related features

One-Line Variable Declaration and Initialization

With 4D v20 R3, programmers can now declare and initialize variables in a single line, eliminating the need for repetitive code. This streamlines the development process, making code cleaner and more efficient.

You can either let the compiler determine the variable type based on the value:

var <variableName> := <value>

Or explicitly specify it for complex types, enhancing code clarity and reducing errors:

var <variableName> : <type> := <value>

Learn more and find examples in the blog post >

Simplifying Variadic Function Writing

Starting from 4D v20 R3, we’ve simplified the declaration of methods or functions that accept an unspecified number of parameters.

You can now use the “…” symbol in your last parameter to indicate that the number of parameters can vary. This enhancement makes your function and method declarations more straightforward and easier to work with.

Learn more and find examples in the blog post >

Incremental Synchronization with Global Stamps

With 4D for Mobile, we introduced global stamps for incremental synchronization.

This feature allows to update or synchronize data by transferring only the changes made since the last synchronization instead of transferring the entire dataset.

This functionality is now open for any need, using the 4D REST Server to do the synchronization, while 4D automatically assigns stamps to newly created, modified, or deleted records. Two new functions allow you to get and set these stamps in case you need to manually overwrite the behavior.

  • The .getGlobalStamp() function retrieves the current global modification stamps associated with the datastore. These stamps represent the data’s modification status.
  • The .setGlobalStamp() function sets and adjusts global stamp values as needed. With each data modification, the global stamp indicates changes since the last sync.

Learn more and find examples in the blog post >

New Function to Sync Several Collections

4D empowers you to work efficiently with object collections, simplifying tasks like sorting, ordering, and filtering. Yet, when data arrives from non-4D systems in the form of arrays, converting them into object collections and back into arrays can be tedious.

In 4D v20 R3, the new multiSort() function simplifies the sorting and synchronization of multiple collections, making data manipulation more efficient.

Learn more and find examples in the blog post >

Customize Websocket Client Headers

Customizing WebSocket client headers lets you inject specific information, preferences, or requirements into the WebSocket connection establishment process.

Starting from 4D v20 R3, you can send security details, application-specific data, or any relevant information to the server using WebSocket client headers.

As the WebSocket client blog post explains, you must create a class to handle WebSocket events. This class introduces a new attribute called headers, an object structured with attributes in the headers format.key:=value.

This attribute provides a flexible way to manage and customize the WebSocket client headers to suit your needs.

Learn more and find examples in the blog post >

Enhancing the ‘Use Log file’ Option

In 4D v20 R3, log management gets an upgrade to offer more configuration options for deployment.

You can now override the “Use log file” option like other backup settings. This option controls whether your application uses a log. When activated, 4D prompts you to create or select a log when creating a new data file, storing the log path in the data file. If you open a data file without a log and this option is enabled, 4D asks you to create or select a log.

The “Use log” option is saved in the “catalog” file by default. But with 4D v20 R3, you can change this during deployment using the backup parameter file. You can place this parameter in the structure, next to the structure, or next to the data.

Learn more and find examples in the blog post >

Improving the Formula from string command

In 4D v20 R3, the Formula from string command is enhanced, allowing formulas to be executed in different contexts. This update simplifies component development, enabling easier access to methods and variables from the host database.

Learn more and find examples in the blog post >

PHP Commands Deprecation & 4D’s Built-In Interpreter Removal

PHP has played a significant role in 4D’s web development, offering features like zip, hash, and LDAP functionality. Over time, many PHP features have become integral to 4D’s core functionality. To streamline and simplify things, we removethe built-in PHP interpreter in 4D v20 R3 and start the deprecation process for PHP commands in v21.

While we won’t completely eliminate PHP commands from 4D, we strongly recommend using system workers to execute PHP code.

Learn more and find examples in the blog post >

4D View Pro

Import and Export Documents in Blob Format

We recognize developers’ challenges when working with larger and more complex 4D View Pro documents. To enhance your experience, we’ve introduced the .sjs file format.

The improvements continue with 4D v20 R3, as we introduce a new blob format that allows you to store compressed documents in your database, providing the same high performance as the .sjs format.

Learn more and find examples in the blog post >

Visual Studio code extension

Show the 4D documentation

4D v20 R3 comes with a newVisual Studio Code editorfeature thanks to the4D-Analyzer extension— the “Show 4D Documentation” feature!

Even though you’re good at understanding 4D commands and classes, sometimes it’s helpful to see the complete information when working with code in VS Code.

Starting from 4D v20 R3, it’s simple: move your mouse over the command, class, or class function you want to know about. A tooltip with a description will appear. At the bottom of this tooltip, there’s a link that says Show documentation.

Learn more and find examples in the blog post >

Read documentation >

4D Netkit

Get labels, fetch and remove emails from Gmail

The previous feature release was the first step of integrating the Gmail API into 4D Netkit. Starting from 4D v20 R3, we’ve introduced commands for retrieving label lists, fetching emails, and removing emails, with more commands on the way.

Learn more and find examples in the blog post >

Microsoft 365

Update mails

Responding to your feedback, we’re introducing a new command to address your requests regarding the ‘isRead’ flag in emails. With the release of 4D v20 R3, Netkit now empowers you to update various properties of received and drafted emails using the ‘Office365.mail.update()’ function.

Using Microsoft Graph, this feature allows for modifying multiple email attributes. Remember that specific properties, such as the body or subject, can only be updated for emails in draft status.

Learn more and find examples in the blog post >

Want to know more? Read all the blog posts about 4D v20 R3

What’s new in 4D v20 R3 – 4D Blog (2024)
Top Articles
Latest Posts
Article information

Author: Jonah Leffler

Last Updated:

Views: 5660

Rating: 4.4 / 5 (65 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Jonah Leffler

Birthday: 1997-10-27

Address: 8987 Kieth Ports, Luettgenland, CT 54657-9808

Phone: +2611128251586

Job: Mining Supervisor

Hobby: Worldbuilding, Electronics, Amateur radio, Skiing, Cycling, Jogging, Taxidermy

Introduction: My name is Jonah Leffler, I am a determined, faithful, outstanding, inexpensive, cheerful, determined, smiling person who loves writing and wants to share my knowledge and understanding with you.