What’s new in 4D 21 LTS

This document highlights all the new features introduced in 4D 21 LTS, covering everything added from 4D 20 R2 up to 4D 21. Each feature includes direct links to its blog post for practical examples and to the documentation for full technical details.

Also, sections with the blank tag focus specifically on what’s new since 4D 20 R10.

This document is divided into ten sections:

4D 21: YOUR AI ENGINE 

4D 21 turns 4D into its own AI engine, delivering a full-featured AI toolkit built for real-world business applications. You can communicate with cloud or locally hosted models, generate and store vectors, run semantic search natively in ORDA, and connect your business logic directly to AI-driven conversations, all without external wrappers, patchwork processes or major architectural changes.

AI becomes a natural extension of your existing code, whether your application is brand new or decades old. With native vector support, streamlined model communication, and tools for embedding intelligent behavior into everyday workflows, 4D 21 makes AI integration smooth, practical, and immediately useful.

Add AI Capabilities with the built-in 4D AIKit Component

4D AIKit is a built-in 4D component that brings OpenAI-compatible capabilities directly into your 4D environment. With just a few lines of code, you can automate processes, enrich user experiences, and integrate intelligent features into business logic without stepping outside of 4D.

AIKit includes over 30 classes designed to support:

  • Text generation and chat-based interfaces

  • Image tagging, object recognition, and descriptive analysis

  • Speech-to-text transcription

  • Visual generation from prompts

  • Moderation of text content

AIKit also enables advanced workflows that blend both cloud-based and locally hosted models. You can build social media automation tools, AI-powered content pipelines, or dynamic learning experiences by combining text and image analysis in a single flow.

NATIVE VECTOR SUPPORT FOR AI EMBEDDINGS & SEMANTIC SEARCH

Intelligent features start with one foundational element: vectors. Whether you’re building semantic search, recommendation systems, document classification, or image grouping, vectors are the structure that represents meaning. With 4D 21, vectors become a native, first-class part of the platform.

4D.Vector is a new built-in class designed specifically for storing and operating on AI embeddings. It holds high-dimensional numeric data in a memory-efficient format and supports key similarity operations like cosine similarity, dot product, and euclidean distance directly inside 4D. This makes semantic queries fast, precise, and fully integrated with your data model.

You can store vectors in your database, use them in class-typed attributes, and build features that sort, compare, or cluster data based on meaning rather than exact matches. It’s the backbone of modern AI-powered workflows, now native to 4D.

To complement this, 4D AIKit introduces native vector generation via OpenAI’s embeddings API. The new OpenAIEmbeddingsAPI.create() method transforms strings or collections into 4D.Vector instances in a single call, no token handling, no HTTP plumbing, no JSON parsing. Once generated, vectors flow seamlessly into similarity scoring, semantic filtering, ranking systems, or ORDA queries.

Together, 4D.Vector + AIKit embeddings deliver a complete pipeline for semantic intelligence:

  • Generate embeddings
  • Store them efficiently
  • Compare and score them natively
  • Run semantic queries directly in 4D

It’s AI-ready architecture, built into the language and the data layer.

SEMANTIC QUERIES blank

You can now integrate semantic search directly into your ORDA queries. Instead of relying on separate processes, you can compare a record’s vector field against a reference vector and instantly return the most relevant results, all within the same ORDA grammar you already use.

The query accepts a simple parameter object with a required vector and optional attributes such as the similarity metric (which defaults to cosine) and a similarity threshold.

// Step 1: Define the kind of profile you want to match semantically
$searchText:="senior project manager with strong HR background, based in France"

// Step 2: Create an AI client (local baseURL optional)
$client:=cs.AIKit.OpenAI.new("YourApiKey")
$client.baseURL:="http://127.0.0.1:1234/v1"

// Step 3: Generate an embedding vector for the search text
$embedResult:=$client.embeddings.create($searchText; "text-embedding-mxbai-embed-large-v1")
$semanticVector:=$embedResult.vector

// Step 4: Build the semantic query object with similarity options
$semanticQuery:={vector: $semanticVector; metric: "cosine"; threshold: 0.4}

// Step 5: Run the query — combine semantic match with traditional filter
$results:=ds.Profiles.query("yearsOfExperience >= 5 & expertise >= :1"; $semanticQuery)

Vector conditions blend seamlessly with classic ORDA logic, so you can combine semantic similarity with traditional filters in a single query. By adjusting the threshold, results can shift from broad and noisy to narrow and precise, giving you meaningful, context-aware results without adding complexity. The entire process stays within the ORDA grammar you already know, keeping your queries clean, expressive, and easy to maintain.

AI Tool Calling and Response Format blank

AI tool calling and structured response formats extend 4D AIKit with the ability to integrate business-specific functions directly into AI-driven conversations. Tool calling allows you to expose selected functionality from your application, such as “list available product categories” or “get top selling products”, as callable tools. When an AI model determines that a tool is needed, 4D AIKit automatically routes the call to your registered 4D functions and integrates the result back into the response. This avoids the need to upload or retrain large datasets, while still enabling the AI to answer user queries with live, application-specific data. In practice, this means you can embed a chat assistant in your application, and when a user asks, “What are the top 10 best-selling products by category?”, the model can call your functions, retrieve real business data, and return the answer in natural language.

In addition, 4D AIKit now supports structured response formats, making integration with downstream processes more reliable. Besides plain text, responses can be requested as strict JSON objects or forced to comply with a JSON schema that you define. This is particularly useful when unstructured input from users needs to be transformed into predictable data, or when AI-generated content must flow into automated workflows without manual cleanup.

Together, semantic queries, tool calling, and structured response formats make AI in 4D not just a conversational layer, but a fully integrated system component, capable of retrieving relevant business data, applying logic securely inside your application, and delivering structured outputs that fit seamlessly into your workflows. And now, with AIKit open-sourced, you gain complete visibility and the ability to shape, extend, and evolve it around your own business requirements.

 NETWORK

4D 21 redefines the networking layer with a modern, performance-driven foundation built for today’s connectivity expectations. Whether you’re running high-latency client/server workloads, switching networks mid-session, integrating devices over TCP or UDP, or optimizing repeated HTTP calls, the entire stack is engineered to deliver faster connections, stronger resilience, and tighter control. QUIC becomes the recommended transport protocol for smoother, low-latency remote sessions, TCP gains asynchronous APIs with TLS and fine-grained timeout handling, UDP arrives with a new event-driven socket API, and HTTP requests benefit from persistent connection management through dedicated agents. Together, these upgrades bring speed, stability, and flexibility to every layer of your application’s network communication.

QUIC: MORE RESILIENT CLIENT/SERVER CONNECTIVITY

QUIC is a modern networking layer designed to make 4D Client/Server connections more resilient and reliable, especially when network quality varies. With 4D 21, you can enable QUIC directly from the Structure, User, or Database Settings, even in compiled applications, making it easy to test and deploy without rebuilding.

In real workloads, QUIC delivers better performance than ServerNet and handles unstable or high-latency connections more gracefully. That means quicker interactions for users, smoother work over Wi-Fi or mobile networks, and a more resilient experience overall.

ServerNet remains supported, but QUIC is now the recommended choice for new deployments aiming to benefit from today’s Internet transport standards. Before migrating an existing environment, be sure to verify that your infrastructure supports UDP, since some networks restrict it. 

Seamless Network Switching with QUIC blank

With QUIC, switching between network interfaces no longer interrupts your 4D Remote connection. Whether you move from Ethernet to Wi-Fi, change adapters, or wake a laptop on a different network, the client automatically re-establishes its session with 4D Server and continues execution without data loss. QUIC enables fast, resilient reconnections across changing network conditions, making the experience smooth even in mobile or unstable environments.

Your workflow stays intact: the execution context is preserved, and processes resume exactly where they left off. On the server side, the client’s IP address updates in real time in the Administration dialog, diagnostic logs, and the Session attributes, giving administrators complete visibility. This makes 4D Remote significantly more robust when network conditions frequently shift.

MODERN SECURE TCP NETWORKING (CLIENTS, SERVERS & TLS)

4D 21 delivers a complete, modern TCP networking stack that replaces the old 4D Internet Commands with a faster, cleaner, and fully asynchronous approach.

The TCPConnection class handles client-side communication with an object-oriented API and callbacks like onConnection, onData, onShutdown, and onError. You can send blobs or text, react to events as they occur, and connect to external devices, services, or custom protocols with ease.

The TCPListener class adds the server side. It lets you listen on a port, accept or reject incoming connections, and hand each accepted client off to a dedicated TCPConnection instance. This gives you a consistent model for building lightweight services or device gateways directly in 4D.

To secure everything, TCP connections now support native TLS/SSL encryption. By enabling the TLS attribute in the new options parameter of 4D.TCPConnection.new(), you establish encrypted sessions automatically, with TLS 1.3 as the default protocol. Standard and secure ports can run in parallel, and encrypted communication begins as soon as the handshake completes.

TCP connections also expose a .connectionTimeout property, giving you direct control over how long to wait before abandoning a stalled or unresponsive connection. This lets you tune latency thresholds, fail fast in poor network conditions, and avoid UI freezes or endless waits. 

Together, these features provide a modern, flexible, and secure foundation for implementing custom TCP protocols and building both client and server networking solutions entirely in 4D.

NEW UDP COMMANDS

The new 4D.UDPSocket class gives developers full control over real-time, event-driven communication using the UDP protocol. It supports both client and server modes and is optimized for fast, connectionless data transmission in use cases like IoT messaging, real-time device monitoring, or internal signaling.

This class is fully event-driven, supporting callbacks such as onData, onError, and onTerminate. Developers can emit and receive packets using send(), analyze packet metadata via 4D.UDPEvent, and log traffic in the unified 4DTCPUDPLog.txt file.

With support for preemptive threads, the UDPSocket class runs efficiently in high-concurrency environments and replaces the legacy Internet Commands plugin with a modern, object-oriented alternative.

OPTIMIZE YOUR HTTP CONNECTIONS WITH HTTP AGENTS

4D 21 introduces HTTP agents, giving you more control over how your application connects to HTTP servers. Agents manage connection persistence and reuse, avoiding the overhead of renegotiating a new connection, especially TLS/SSL, for every request.

By default, all HTTPRequest commands now use a built-in agent that keeps connections alive. When you need more control, you can create your own agent to fine-tune behavior such as:

  • keep-alive handling

  • maximum concurrent connections

  • connection timeouts

  • TLS/SSL configuration at the agent level

Using an agent is simple, you create it once and pass it through your request options. Because HTTPAgent is a shared object, you can also keep a single agent for all requests to the same server, or even reuse it across multiple servers, each maintaining its own connection pool.

HTTP agents make repeated calls faster, more predictable, and easier to manage, especially in applications that interact heavily with external APIs.

 ORDA

4D 21 expands ORDA with deeper lifecycle control and more refined data handling, enabling developers to build cleaner, more self-contained business logic. With new lifecycle events, constructor support, smarter entity filtering, and memory cleanup features, the data layer becomes not just a storage system, but a responsive, rules-driven engine built right into your model.

COMPLETE Entity Lifecycle Events MODEL blank

4D 21 introduces a complete, unified lifecycle model for ORDA entities, giving you full control over how data behaves from creation to deletion. Instead of scattering rules across forms, APIs, or triggers, you now define your entire business logic directly inside your dataclasses: cleaner, centralized, and easier to maintain.

This lifecycle begins the moment an entity is created. Entity constructors let you assign default values, initialize context-specific logic (such as the current user or session), or pre fill attributes automatically. As soon as an entity is modified in memory, the onTouch event reacts to those changes in real time, making it easy to normalize values, enforce rules, or prepare dependent updates before any save operation begins.

When an entity is saved, 4D 21 now runs a three-phase sequence: validateSave, saving, and afterSave. This lets you block invalid operations early, apply business logic while the save is in progress, and trigger follow-up actions once the operation completes. The same three-phase pipeline exists for deletions with vvalidateDrop, dropping, and afterDrop, allowing you to prevent unauthorized removals, clean up related data, and run post-delete logic consistently.

All events are available at both the entity and attribute levels. Validation events can block operations when rules aren’t met, while post-events always execute, even if the operation fails, ensuring reliable, predictable behavior throughout your model.

By consolidating this logic inside your ORDA dataclasses, entity behavior becomes predictable, self-contained, and consistent across your entire application. Business rules are no longer hidden in triggers. External systems can integrate cleanly through native event hooks. And in ORDA-based projects, traditional triggers are no longer needed, the lifecycle events deliver the full power of ORDA in a cleaner, more maintainable architecture.

Restrict data on entity selections

Controlling who sees what data is critical in business applications, and now you can define those rules once, cleanly, and directly in your data model.

While the existing permission system in 4D controls whether users can access an entire dataclass, the new restrict() function introduced in 4D 21 refines that access further. It lets you enforce contextual filters on entity selections based on session values, user roles, or any other runtime logic.

Rather than applying filters manually throughout your code, you define them once inside the dataclass using the restrict() function. For instance, a salesperson could be limited to viewing only the customers they manage, while admins still see the full dataset, all determined automatically during each read operation like query() or all().

This central approach not only strengthens security but also keeps your logic clean and consistent across both web and client-server contexts.

CLEAN ENTITY SELECTIONS WITH AUTOMATIC GAP REMOVAL

When users delete entities from a selection, the interface often ends up cluttered with empty placeholders. It breaks the flow, adds friction, and makes your UI feel less responsive.

With 4D 21, the new clean() function solves this in one line. After performing a drop, you simply call .clean() on the entity selection to automatically remove any gaps left by deleted entities. It’s seamless, efficient, and restores a polished, uninterrupted view without manual rebuilding.

This small addition translates to a big improvement in interface quality and user experience. And it’s not limited to the UI: the $entityset REST API also supports a clean parameter, allowing your API responses to return clean, gap-free data even after deletions.

Whether you’re developing a desktop interface or working with web clients, this feature keeps your data views tidy and your user interactions smooth.

 4D Qodly Pro

4D Qodly Pro lets you extend your business application with modern browser-based interfaces, all without writing a single line of HTML or JavaScript. With a visual drag-and-drop editor, you can build responsive web forms and connect them directly to your 4D business logic.

Qodly pages can be embedded directly into classic 4D forms using a Web Area. From the user’s point of view, it all feels like a single, unified interface. There’s no need for separate windows or extra licenses. The embedded Qodly page shares the same session and license as the 4D Remote client, keeping the experience both transparent and at no additional cost.

If you want to see how quickly this comes together in practice, you can watch the official 4D Qodly Pro webinar replay, a walkthrough of how to add browser-based forms to a real 4D application.

BUILD MODERN WEB INTERFACES WITHOUT REWRITING YOUR APPLICATION

4D Qodly Pro lets you create modern, browser-based interfaces right on top of your existing 4D application, without learning web frameworks, rewriting logic, or managing separate codebases. You design pages visually, bind data visually, secure access visually, and expose APIs visually, all while staying inside your familiar 4D workflow. The result is a faster path to the web with less code, less complexity, and no disconnect between your UI and your business logic.

  • Extend or move your desktop applications to the web without restructuring your architecture: Qodly Pages sit on top of your existing ORDA model and server classes. Your logic, database, and security rules stay exactly where they are.

  • Build responsive interfaces visually using reusable components: You drag components onto the canvas, configure them through side panels, and bind them to qodlysources without code. Crafted components and ready-made templates let you assemble screens quickly with consistent styling.

  • Speed up development by removing frontend complexity: Data binding, formatting, conditional states, events, and navigation are all visual. No HTML, CSS, or JavaScript is required, just 4D logic and Qodly Studio’s panels.

  • Use the 4D Client license you already have: When a Qodly Page is embedded in a Web Area of a 4D Remote client, it runs under the same session and license. Users see a unified interface, and deployment stays simple and cost-effective.

  • Keep teams productive with a familiar drag-and-drop experience: Qodly Studio is modeled after the 4D form editor, making it easy for new developers to join the project and for experienced 4D teams to work faster.

  • Design, logic, and data all live in the same environment: Qodly Studio handles layout, Qodly Pages define structure, and your business rules sit in your classes. Nothing is scattered across external files or disconnected frameworks.

  • Build dynamic behavior visually: Conditional and non-conditional states let pages adapt to user roles, data changes, or UI interactions, all configured through guided panels. You see exactly when and why elements appear, change, or react.

  • Define roles, privileges, and access rules visually: A dedicated interface lets you build role hierarchies, assign privileges, and review final permissions at a glance. It clarifies who can read, update, delete, or execute each part of your application.

  • Expose server logic as simple, visual HTTP handlers: You pick a class, choose a method, define a URL pattern, and Qodly handles the routing. It’s an easy way to publish APIs or integrate external systems without additional layers or frameworks.

  • Debug pages directly on your 4D Server: You preview UI changes instantly, inspect qodlysources, and use the 4D debugger inside Qodly Pro — running exactly where the logic executes.

Custom Components: Extend Qodly with Your Own Building Blocks

4D Qodly Pro also supports Custom Components, giving you a way to extend the UI when you need something beyond the built-in toolkit.

  • Add new capabilities with your own React components: Complex widgets, specialized visualizations, or unique interactions can be built as React components and uploaded directly into Qodly Studio.

  • Reuse them across projects or share them within the community: Custom Components behave like native components once installed, drag-and-drop, bind data, apply styles, and trigger events exactly the same way.

  • Keep development efficient: Instead of recreating specialized UI every time, you install a component once and use it everywhere.

  • Blend smoothly with the rest of your UI: You control the appearance, behavior, and integration, while Qodly ensures components run efficiently inside its runtime.

And with an active community continuously sharing Custom Components, you can enrich your toolbox without building everything yourself.

Automatic Qodly Studio Setup blank

Launching Qodly Studio for the first time from 4D Design mode triggers an automatic setup wizard. Any required settings: REST server activation, scalable sessions, web server ports, are detected and presented with a prompt to enable them.

If accepted, services restart as needed and Qodly Studio opens in the browser. If declined, no changes occur. The workflow is smooth, fast, and hands-free for new users.

SHARED Sessions & INTERACTIONS Between Client/Server applications and 4D Qodly Pro blank

When a Qodly Page is displayed inside a Web Area of a 4D Remote client, it runs under the same session and the same license. This means no extra license is consumed, and the same session context flows seamlessly between the desktop form and the 4D Qodly Pro page.

Authentication and privileges are preserved automatically, and session data can be passed to initialize the web page with context from the desktop, for example, showing details of the currently selected entity.

Alongside session sharing, 4D Qodly Pro actions enable direct two-way interaction between 4D forms and 4D Qodly Pro pages. From a Qodly page, developers can call 4D functions through the $4d object, previously initialized with the WA SET CONTEXT command. Conversely, a 4D form can update Qodly Sources directly, ensuring synchronized state and logic across both environments.

Together, these enhancements make it easy to combine classic 4D forms with modern Qodly pages in a single application, unifying sessions, interactions, and context while avoiding redundant logins, extra licenses, or complex integration work.

Built-in Internationalization (i18n) blank

4D Qodly Pro includes built-in internationalization (i18n), so your applications can adapt seamlessly to multiple languages and regional settings.

Supported languages are defined as locales in the new Localization section, where translation keys and values can be managed and bound to components. Language choice is handled by the built-in UserLanguage Qodly Source, applying the user’s selection in real time.

Automatic fallbacks cover session data, browser defaults, or a primary locale, while native right-to-left (RTL) support makes languages like Arabic feel natural. Switching languages updates content instantly, creating a smooth, personalized experience.

This enables you to expand into new markets, reduce onboarding friction, and strengthen user trust without redesigning your UI or adding complexity. Whether launching locally or globally, your product is ready to speak your users’ language.

Qodly page Events Report blank

The Events Report provides a clear, unified view of all events on your page, whether they come from standard actions, navigation actions, class functions, or dialog actions. It shows which events are declared, where they’re implemented, and the exact order in which they execute.

By making event flow transparent, it speeds up debugging, uncovers overlaps or missing handlers instantly, and makes optimization straightforward. Teams can collaborate more easily, and you gain confidence knowing exactly how your page behaves.

It’s a simple way to bring clarity, accuracy, and efficiency to event management, whether you’re building a small application or a large-scale solution.

CANVAS ZOOM CONTROLS blank

4D Qodly Pro pages editor includes canvas zoom controls to make working with complex layouts easier. Developers can now zoom in, zoom out, or reset the view directly from the toolbar, with support for keyboard shortcuts and mouse wheel navigation.

The current zoom level is displayed in the interface, giving developers precise control over how they view and arrange components on the canvas.

These enhancements improve navigation, design accuracy, and overall usability, aligning the pages editor with the standards of modern visual design tools.

 DATABASE

4D 21 strengthens the foundation of your data model with features that bring more structure, more reliability, and better performance at scale. You can now assign classes directly to object fields for guaranteed shape validation and safer, typed models. Record selections stay consistent even when data changes in the background, ensuring stable results for long-running operations. And with new support for UUID v7, your identifiers become time-ordered and index-friendly, making large datasets easier to sort and faster to query across distributed systems.

CLASS-TYPED OBJECT FIELDS IN STRUCTURE EDITOR

In the Structure Editor, object fields can now be assigned to a specific class. This isn’t just metadata, it’s a contract that 4D enforces at multiple levels.

Assign a user class to an object field and you’ll get:

  • Property-level autocompletion

  • Syntax checking at compile time

  • Runtime validation of object shape

If the object doesn’t match the declared class, 4D raises an error. Structure becomes schema, your data stays clean, and when combined with 4D.Vector, defining a typed vector attribute inside your class means every entity carries its own semantic fingerprint, ready for similarity scoring, AI-driven sorting, or intelligent recommendations.

KEEP RECORD SELECTIONS CONSISTENT

4D 21 strengthens data reliability by ensuring that record selections remain stable even when records are deleted and new ones are created in the background.

In earlier versions, removing a record could free an internal slot that might later be reused by a newly created record, making an existing selection unexpectedly include data that didn’t match the original criteria.

Now, once a selection is built, it remains consistent for its entire lifetime. Deleted records simply disappear from the selection, and newly created records never slip in. This applies to both classic QUERY selections and ORDA entity selections.

With this update, loops, mail merges, background tasks, and long-lived selections behave exactly as intended, no surprises, no extra checks, just reliable results.

SUPPORT FOR V7 UUIDS

UUID generation just got smarter. Generate UUID now supports version 7 identifiers. That means your UUIDs are not only universally unique, they’re chronologically sortable, database-friendly, and designed for modern distributed systems.

Internally, v7 UUIDs embed timestamp data, making them ideal for ordered storage and easier to index. It’s a small change with a huge impact on scale and query performance.

 4D Component

4D 21 brings two major advances to component development: a fully modern dependency manager and seamless in-project component editing. You can load “only what you need” with optional component management, pull components directly from GitHub, keep everything automatically aligned with your 4D version, and rely on 4D to resolve recursive dependencies and prevent conflicts. At the same time, you can view, edit, and debug component code directly inside your host project, making component-based development faster, cleaner, and far easier to maintain. Together, these changes create a streamlined, predictable workflow for building, sharing, and scaling components across teams and projects.

SEAMLESS IN-PROJECT COMPONENT INTEGRATION blank

Component development in 4D has taken a major step forward. Methods and classes from a component, whether shared or not, can now be viewed and edited directly in the host project, without having to open the component separately or break focus during development. All methods can now be edited on the spot, and entire components can be created from the host UI, initialized with namespace, files, and structure, then edited immediately in interpreted mode.

Beyond code, visibility has expanded to include read-only forms, folders, constants, commands, plug-ins, and even a component-specific Trash. Constants maintain linkage to their source components, ensuring consistency across the app, while new creation flows automatically wire dependencies and set up structure for both managed and legacy modes.

Altogether, this makes component iteration faster, modularization smoother, and projects cleaner and more transparent. It’s a significant milestone in bringing components closer to the host project workflow, while further improvements are still on the roadmap.

OPTIONAL COMPONENT MANAGEMENT blank

4D 21 no longer include standard 4D components. Instead, you declare your need for them through the Add Dependency dialog, and 4D automatically fetches and installs them on demand. From there, you can directly access the complete catalog of 4D components, including 4D AI Kit, 4D NetKit, 4D View Pro, SVG, and more, all published as open source on GitHub. This gives you the flexibility to install only what you need while also making it easier to explore component internals, contribute improvements, and align your projects with evolving needs.

  • Focused dependencies: Only required components are installed.

  • Version alignment: Dependencies follow your current 4D version by default, ensuring compatibility without manual checks.

When upgrading to 4D 21, existing projects can automatically download the required components, while binary databases continue to access them through the installer or the download portal.

Automate Dependency Compatibility with Follow 4D Version

The Follow 4D version rule simplifies dependency management by automatically syncing your dependencies with your 4D environment. This reduces compatibility issues and saves you time.

  • Automatic Compatibility: Dependencies align with your 4D version, no manual tracking needed.
  • Effortless Updates & Downgrades: Dependencies update automatically when upgrading or downgrading 4D.
  • Reliable Dependency Resolution: The system resolves dependencies based on structured tag naming conventions for LTS and R releases.

GITHUB-NATIVE COMPONENT INTEGRATION AND DEPENDENCY CONTROL

Component integration in 4D 21 is designed for the way development actually happens now. Teams share code. Internal libraries evolve. Public components improve. And everything moves through GitHub. The new dependency system connects your project directly to those repositories so components install, update, and stay aligned with their source without any manual handling.

Once a component is referenced, 4D pulls it straight from GitHub and applies semantic version rules so you can decide exactly how tightly or loosely you want to track updates. You can freeze a version when stability matters, stay within a safe range when you want controlled upgrades, or follow the latest release when you are iterating fast. When a new version becomes available on GitHub, 4D highlights it immediately so you can update a single component or the whole set in one step.

Private repositories fit right in. You add a token once, and 4D handles the rest, fetching internal components as smoothly as public ones.

This creates a clean, predictable flow. Every component is traceable. Every update is intentional. Every dependency stays connected to the codebase that defines it. Adoption becomes easier, maintenance becomes lighter, and sharing code across teams becomes a natural part of your workflow.

RECURSIVE DEPENDENCY RESOLUTION & MANAGEMENT

The Component Manager now understands the full tree. Once a component is inside your project, 4D analyzes every dependency it relies on, loads the required ones automatically, and checks for conflicts before they surface. 

Recursive loading ensures that sub-dependencies never go missing. Version ranges are resolved intelligently so multiple components can depend on the same library without breaking your build. And if a cycle appears, 4D blocks it at the root to keep your project stable.

You get clear visibility into the structure: declared dependencies, indirect ones, and exactly which component requires what. Every add, update, or removal is propagated through the tree so your project stays coherent without manual cleanup.

Adding and removing local components

Managing local components in 4D 21 is now far smoother and more predictable. The Project Dependencies interface gives you a single place to add, remove, and organize components without touching the file system or hunting through project settings.

Everything is driven by two files: dependencies.json, which centralizes all project dependencies for consistency, and environment4d.json, which handles customizable component paths. When you add a local component, 4D writes the correct entry automatically. If the component lives elsewhere, both files are updated so the project opens cleanly on any machine, on macOS or Windows. Removing a component follows the same flow, with confirmation prompts to avoid accidental breaks and automatic cleanup to keep your configuration stable.

A restart is required for any change to take effect, and 4D guides you with clear notifications. The entire process cuts friction, reduces setup time, and gives you faster, more reliable access to the components you depend on.

USE CLASSES ACROSS COMPONENTS WITH DECLARED NAMESPACES

4D 21 makes component interaction much simpler. When a component declares a namespace, all its classes automatically become available to every other component in the same host project.

This removes the need for special configuration or workarounds, just include the components you need, and you can directly use their classes through cs.<namespace> in your code.

This approach makes component-based development more modular, predictable, and easier to maintain.

UPDATED COMPONENT STRUCTURE FOR SILICON MACOS NOTARIZATION

4D 21 introduces a redesigned component structure that aligns with Apple’s notarization requirements for Silicon-based Macs. Components now follow the same layout as a full 4D application, which makes notarization more reliable and removes the structural issues developers faced with older formats.

Metadata is now generated automatically at build time. Fields such as CFBundleDisplayName, CFBundleShortVersionString, CFBundleVersion, and copyright information are filled in directly from your build settings. When using Build4D, these values come from your buildApp.4DSettings, so components are packaged correctly without extra configuration.

Note that updated structure is not compatible with older 4D versions like 4D 20 R7 or 20 LTS. Components built with 4D 20 R8 introduced this new structure and can still load older components, but older versions cannot load components built using the updated layout.

4D NetKit & Mailing

4D NetKit has grown from a set of Microsoft 365 and Google utilities into a deeper authentication and communication framework. It gives your application Single Sign-On through Microsoft 365, and it extends that capability with full OpenID Connect support, opening the door to a wide range of identity providers: Google, Okta, enterprise IAM systems, anything that speaks the standard.

The result is an environment where login flows, token handling, email operations, and calendar integrations no longer feel like external systems bolted on from the outside. They become part of your application’s foundation: secure, modern, and predictable. 

COMPLETE GMAIL MESSAGE & LABEL MANAGEMENT

Gmail integration in 4D 21 grows from a simple “send mail” entry point into a complete, programmable mailbox. Once your app authenticates through OAuth 2.0, Gmail behaves like another layer of your logic, not a remote service you have to wrestle with.

It begins with sending. You build structured emails and deliver them through the Gmail API, bypassing the fragility of SMTP relays and legacy protocols. It’s clean, predictable, and secure.

From there, the inbox opens up. You can read it, shape it, reorganize it, and clean it, all with the same precision you apply to your own data structures.

You can now:

  • Retrieve Gmail’s full label list, including system and custom labels

  • Fetch message IDs for any label (Inbox, Trash, unread, folders)

  • Load full email content on demand

  • Delete or trash messages in a single call

  • Retrieve multiple emails at once, up to 100 per request

  • Assign or remove labels, including combinations like Work + IMPORTANT

  • Programmatically create, update, and delete labels

  • Pull label metadata such as unread counts and total messages

What this gives you is not “email access”, It’s email automation.

CREATE AND MANAGE GMAIL DRAFTS

4D 21 lets you create Gmail drafts directly inside the mailbox, placing them under any label you choose without sending anything. It’s a simple way to keep reusable templates exactly where they belong, in Gmail, ready to be retrieved, edited, and sent when the moment calls for it.

Using the Gmail API, you can append a message as a draft (with the default DRAFT label or your own custom label), reopen it later, modify it, and send it through the standard Gmail flow. Once a draft is no longer needed, you can remove it cleanly.

UPDATE MICROSOFT 365 MAIL PROPERTIES

4D 21 gives you direct control over Microsoft 365 messages, letting you update the properties of received or drafted emails through Office365.mail.update(). The request for changing the isRead flag is what opened the door, but the feature goes further.

Through Microsoft Graph, you can adjust attributes such as read status, categories, or importance. And when you’re working with drafts, you can even update deeper elements like the subject or body. It’s a clean way to keep mailbox state in sync with your workflows, without manual handling or external tooling.

You decide how your application reacts: marking a message as processed, tagging it for review, reclassifying it based on business rules, or preparing a draft message for later completion. Everything stays under one API, one authentication flow, one consistent model.

FASTER UNREAD EMAIL COUNTS ACROSS MULTIPLE MAILBOXES

With 4D 21, checking unread email counts is much more efficient. The IMAPTransporter.getBoxList() function can now return mailbox properties and unread counts in a single request, which significantly improves response times.

If you want an overview of all mailboxes, including unread, total, and recent email counts, you can enable the “withBoxInfo” option and retrieve everything at once:

var $boxes := $transporter.getBoxList({withBoxInfo: True})
If you only need counts for specific mailboxes, just pass their names in a collection:
$boxes := $transporter.getBoxList({ withBoxProperties: False; withBoxInfo: True; names: ["INBOX"; "Drafts"] })
These improvements make it easy to keep users updated with fresh unread counts while reducing the number of server calls. The same enhancements also apply to the Gmail API in 4D NetKit, giving you consistent gains across both IMAP and Gmail integrations.

ACCESS GOOGLE USER & DIRECTORY INFORMATION

4D 21 gives your application direct access to Google user data, making it easier to personalize interfaces, automate communication flows, and work with domain-wide directories. Once authenticated through OAuth 2.0, you can pull everything from the current user’s basic profile to full contact lists and organizational records.

You can retrieve:

  • The currently authenticated user’s details

  • Domain profiles and contact directories

  • Specific user records using a resource name and field masks

These capabilities let your app adapt to the people using it, showing who’s logged in, pulling the right recipients automatically, or syncing organizational data without manual lookups.

FULL CALENDAR MANAGEMENT FOR GOOGLE & MICROSOFT 365

Calendar handling in 4D 21 moves from simple retrieval to full control with the new cs.NetKit.Office365.calendar and cs.NetKit.Google.calendar classes. Your application can read calendars, pull events, and manage the entire lifecycle of a meeting, whether it lives in Google Calendar or Microsoft 365. One OAuth 2.0 connection, and suddenly your scheduling workflows stop feeling like external systems and start behaving like extensions of your app.

You can retrieve every calendar linked to an account, pick the one your logic cares about, and load its events with filters for ranges, limits, or recurrence. From there, you’re free to shape the meeting itself: start and end times, attendees, reminders, categories, recurrence rules, even video-conference links like Teams or Google Meet.

Creating, updating, or deleting events becomes a single call. If an event is canceled, attendees are notified automatically. If it’s updated, the platform handles resending details. Your job becomes shaping the workflow, not managing HTTP calls or reconciling API differences between ecosystems.

In practice, you can:

  • Retrieve calendars across Google and Microsoft 365

  • Load events with time windows, filters, and optional expansion

  • Create meetings with attendees, descriptions, reminders, and links

  • Update only the fields that matter without rebuilding the event

  • Delete events cleanly, with the platform handling notifications

ENHANCED OAUTH2, OPENID CONNECT & AUTHENTICATION CONTROL

Authentication in 4D 21 becomes smoother, more secure, and far more flexible. 4D NetKit now manages the entire OAuth2 and OpenID flow with major providers, Microsoft, Google, GitHub, Okta, and any OAuth2-compatible server, while giving you full control over security, presentation, and callback behavior without adding extra layers of code.

4D NetKit handles the complete exchange automatically: client ID, redirect URI, scopes, token retrieval, and the return flow. Once authentication succeeds, your application can display its own HTML page directly to the user, keeping the experience clean and fully integrated.

Here’s the full set of enhancements, merged into one unified feature:

  • Enhanced OAuth2 authorization flow: 4D NetKit now manages the full OAuth2 exchange for providers like Microsoft, Google, GitHub, or any custom OAuth2 server, handling the client ID, redirect URI, scopes, token retrieval, and final return. This creates a smoother onboarding experience with no awkward system pages, no confusing transitions, and a clean handoff straight back into your app. The moment authentication succeeds, you can display your own HTML page so the flow feels integrated, modern, and entirely under your control.

  • PKCE (Proof Key for Code Exchange) protection for safer authorization: By enabling PKCEEnabled in cs.NetKit.OAuth2Provider, every authorization-code exchange becomes cryptographically secured. This protects your application against interception or replay attacks, especially important for desktop and native applications, by ensuring that the returned authorization code can only be used by the original requesting client. You get a major security upgrade without writing any cryptographic code yourself.

  • Certificate-based OAuth2 authentication for enterprise-grade security: Instead of relying on client secrets, you can authenticate using a private key and certificate thumbprint. 4D NetKit builds and signs the assertion automatically, dramatically reducing exposure risks and aligning with modern enterprise security practices, such as those required by the Microsoft Identity Platform. By setting the permission to Service and providing .privateKey and .thumbprint on your cs.NetKit.OAuth2Provider object, the full certificate handshake and token exchange execute securely and consistently across environments.

  • Custom display control for OAuth login flows: Setting browserAutoOpen to False in your cs.NetKit.OAuth2Provider credentials gives you full control over where the login screen appears. You can display it inside a Web Area, embed it in a dialog, or integrate it into a guided workflow that matches your UI. The security flow remains managed by 4D NetKit, but the presentation becomes yours, creating a login experience that feels native instead of external, ideal for branded applications or smooth onboarding flows.

  • Use the host web server for OAuth2 callbacks: OAuth responses can now return directly through your host web server’s own ports. 4D NetKit automatically chooses the correct server based on your redirect URI: matching ports go to the host server, standard ports like 80 or 443 default to it, and anything else falls back to the internal NetKit server. When the host server is used, you simply add an HTTP handler to catch the callback, and NetKit.OAuth2Authorization.getResponse completes the exchange. This avoids secondary listeners, port conflicts, and setup complexity, making authentication flows cleaner and easier to deploy.

  • OpenID Connect compliance with state and nonce handling blank: The authentication flow now fully supports state and nonce, letting your application validate redirect integrity and enforce token uniqueness automatically. state protects against CSRF-like tampering by ensuring the response matches the request, while nonce prevents replay attacks by guaranteeing tokens are fresh and unique. Since 4D NetKit manages both parameters internally, you integrate with modern OpenID providers, Google, Microsoft, and Okta, without building custom validation layers.

  • Custom URLs for authentication success and error outcomes blank: The authenticationPage and authenticationErrorPage attributes in the cs.NetKit.OAuth2Provider.new() command now accept full URLs, giving you total control over what the user sees after authentication. Your success or error pages can be hosted anywhere, in a 4D Qodly Pro app, on your own web server, or on a third-party service, instead of being limited to local HTML files. This lets you deliver dynamic, branded, context-aware responses that can be updated independently of your 4D application, with no deployments or rebuilds required.

 HTTP SERVER

4D 21 expands the HTTP server into a more capable, more secure, and more developer-friendly layer. You can define response rules globally, route requests through clean handler mappings, return structured web content, and integrate external systems without risking session exposure. Real-time communication becomes easier with full WebSocket client support, and license usage stays under your control with smarter authentication flow options. Everything is designed to simplify routing, strengthen security, and streamline how your web endpoints communicate.

custom http response rules blank

HTTP response headers in 4D are now configurable at the server level. Using a new HTTPRules.json file or the settings.rules parameter during startup, developers can define response rules matched by URL pattern. Supported rules include:

  • removedHeaders: strip unwanted headers (e.g., remove the Server header for stricter audits).

  • addedHeaders: inject security headers like Content-Security-Policy, X-Frame-Options, or Permissions-Policy.

  • denyAccess: block access to sensitive paths with a 403 status.

  • redirection: route requests for images, CSS, or JavaScript to a CDN.

  • status: explicitly define the response status code.

By handling headers directly within 4D, infrastructure becomes leaner, with far less reliance on external reverse proxies or manual header injection. Consistency improves, and policies are enforced at the framework level for all web responses, including REST.

STRUCTURED HTTP ROUTING WITH REQUEST HANDLERS

4D 21 introduces HTTP Request Handlers, a cleaner and more modular way to decide how your server responds to incoming web requests. Instead of writing large On Web Connection blocks, you map URL patterns to class functions, making your routing easier to organize, test, and maintain.

With the new 4D.IncomingMessage and 4D.OutgoingMessage classes, you can inspect URLs, headers, parameters, and body content, then return structured responses, whether you’re authenticating users, serving files, redirecting to pages, or handling uploads.

Everything is configured through HTTPHandlers.json, where each entry defines:

  • The URL pattern to match

  • The HTTP verbs to accept

  • The singleton class and method that handle the request

This gives you precise control over request routing, cleaner separation of business logic, and built-in support for scenarios like authentication redirection, file handling, and even forwarding users to Qodly pages.

SECURE, SESSION-SAFE INTEGRATIONS WITH ONE-TIME PASSCODES

4D 21 adds One-Time Passcodes (OTPs) and session restore tools that make it easier to connect your web applications to third-party systems without exposing session cookies or breaking the user flow.

With Session.createOTP(), you generate a single-use passcode linked to the current web session. You can safely send this OTP to external services, for example, in email-verification links or inventory-processing callbacks, without ever exposing the 4D session cookie. When the request returns, 4D automatically restores the correct session using:

  • $4DSID in the URL, when allowed

  • Session.restore(), when the provider only supports a state parameter

This keeps user context intact across multi-step processes, prevents interception risks, and supports cleaner integrations with external APIs.

WEBSOCKET CLIENT SUPPORT FOR REAL-TIME COMMUNICATION

Real-time updates are essential in modern applications, from dashboards to IoT interfaces. To support this, 4D 21 introduces the 4D.WebSocket class, giving you a simple way to build WebSocket clients that connect to any WebSocket server.

WebSockets create a full-duplex connection, letting you send and receive messages instantly. You could already host your own WebSocket server using 4D.WebSocketServer; now you can also connect to external ones, exchange messages, and react to server events.

Just define a handler class with callbacks like onMessage, onOpen, onTerminate, and onError, then create your client with:

Form.webSocket := 4D.WebSocket.new($url; cs.WSConnectionHandler.new())

From there, your app can listen for incoming messages and push updates in real time, perfect for chat features, live dashboards, IoT devices, and more.

CUSTOM Websocket Client Headers

When you need to pass extra information during a WebSocket handshake, like security tokens, app metadata, or custom identifiers, 4D 21 lets you define custom headers directly from your WebSocket client.

You simply add a headers attribute to your WebSocket handler class. This object works just like standard HTTP headers, using key/value pairs:

This.headers := New object("x-authorization"; $token) 
This.headers.Cookie := "yummy_cookie=choco; tasty_cookie=strawberry"

These headers are automatically sent when the connection opens, giving you a flexible way to authenticate, personalize, or configure your WebSocket sessions without changing server code.

Perfect for token-based security, multi-tenant setups, or any workflow where the client must introduce itself before data starts flowing.

DELIVER CUSTOM WEB CONTENT WITH THE OUTGOINGMESSAGE CLASS

4D 21 introduces the OutgoingMessage class, making it much easier to return custom content, like files, images, or binary data, from your web or REST endpoints. Instead of being limited to scalar values or ORDA entities, you can now send full web-ready responses directly to the browser.

With this class, you can set headers, define the response body, and choose the HTTP status code, giving you complete control over how content is delivered. It’s ideal for use cases such as downloading PDFs, serving images, or returning any binary payload.

To make this even smoother, 4D now supports the onHTTPGet keyword. When added to an exposed function, that function becomes callable through a simple browser GET request, perfect for user-friendly links or direct file downloads.

CONTROL LICENSE USAGE WITH FORCE LOGIN

4D 21 introduces Force Login, a mode that prevents REST requests from consuming a 4D Client license until the user actually authenticates. Loading a Qodly page, viewing a form, or triggering descriptive REST calls no longer ties up a license, only successful authentication does.

This keeps login screens from blocking resources, reduces unnecessary license usage, and gives you full control over when licenses are allocated. Once the user logs out, the license is released immediately.

 4D Write Pro

4D Write Pro takes a big step forward with new tools that make documents easier to build, smarter to format, and more powerful to automate. Tables adapt intelligently to your data, layouts are easier to shape visually or programmatically, documents scale to thousands of rows without effort, exporting becomes more capable with PDF/A, attachments, and e-invoice support. And for the first time, an integrated AI assistant helps you write, refine, and improve your content directly inside 4D Write Pro.

AI-POWERED WRITING ASSISTANT FOR 4D WRITE PRO

4D Write Pro now features an AI-powered writing assistant that helps you draft, edit, and refine your documents directly inside 4D Write Pro. Once connected to the OpenAI API, you get real-time support for improving clarity, fixing errors, reshaping text, or simply finding the right words.

You activate AI features by setting your API key with WP SetAIKey. After that, a new AI button appears in the interface, giving you quick access to helpful tools.

You can chat with the assistant to get ideas, improve phrasing, or resolve writer’s block. Predefined actions make things even faster: summarize content, translate text, check grammar, or rewrite sections for better flow.

When inserting AI-generated content, you choose how it’s applied, plain text, fully styled, or copied for later use. A built-in request history lets you revisit past prompts, jump to earlier responses, and reuse results without losing track of your work.

PDF/A EXPORT, ATTACHMENTS & E-INVOICE SUPPORT

4D 21 extends 4D Write Pro with a complete toolset for producing archival-ready PDFs, embedding attachments, and generating electronic invoices. At the center of these improvements is support for the PDF/A family, a preservation-focused version of PDF designed to keep documents readable for decades, while enabling new workflows such as e-invoicing.

For teams across all industries, legal, medical, technical, accounting, construction, public works, and more, PDF/A-3 stands out because it lets you embed attachments directly inside the document. With the new files export option, you can bundle text files, images, XML, or other documents into a single durable PDF.

Exporting follows the same workflow you already know: through the interface or programmatically, choosing formats like PDF/A-2 or PDF/A-3. When using PDF/A-3, attachments are simply included through the export options, ideal when you want a self-contained archive that keeps all related information together.

This enhancement also enables electronic invoice generation. Modern e-invoices typically rely on PDF/A-3 combined with a structured XML file that contains invoice details in standardized formats such as FACTUR-X (France) or ZUGFeRD (Germany). In 4D Write Pro, you create these hybrid invoices by adding the XML through the facturX object and the files collection during export.

ADVANCED SECTION CONTROL FROM INTERFACE & CODE

4D 21 gives you far more control over how your documents breathe and flow. Sections and subsections stop being hidden mechanics and become tools you can shape, visually from the interface or precisely in code.

The section controls now surface richer options through simple menus, letting you insert breaks, define different first pages, split left and right pages, or strip headers and footers from specific ranges. What used to require digging into attributes is now a quick click at the moment you need it.

On the programming side, new section-management commands let you cleanly remove or reset structural elements without disturbing the rest of the document.

  • WP DELETE SECTION removes an entire section, its content, headers, footers, and anchored elements, without collapsing formatting or shifting indexes in unpredictable ways.

  • WP DELETE SUBSECTION clears attributes tied to “different first page” or “different left/right pages”, including anchored images and text boxes.

  • WP RESET ATTRIBUTES wipes overrides at either the section or subsection level, letting you return to inherited formatting in one step.

Combined, these enhancements give you a smooth top-down workflow: intuitive editing from the interface when shaping layout, and precise programmatic control when your logic needs to reset, prune, or rebuild sections on demand.

SET PAGE SIZE IN ONE STEP WITH wk page size

4D 21 adds a new 4D Write Pro document attribute, wk page size, making it much easier to define the overall size of a document. Instead of setting width and height separately, you can now apply both at once with a single value.

You can choose from:

  • Built-in printer formats

  • Your own custom formats

  • A full range of ISO sizes (A0–A10, B-series, C-series, DL, Legal, Tabloid, and more)

This means you can design documents for printing or export without worrying about which printer is currently selected. Whether you’re preparing letters, invoices, booklets, or custom layouts, setting the right size is now simpler, faster, and more consistent.

Wrap text around pictures and Text boxes

With 4D 21, pictures and text boxes now offer text wrapping capabilities, which provides flexibility in document layout design. With new anchor modes, users can wrap text around images and text boxes, creating visually appealing documents without constraints.

The 4D Write Pro interface has been improved to let you choose how you want pictures and text boxes displayed. New values for image/anchorLayout and textBox/anchorLayout standard action are available. You can also adjust these settings via programming using the new attributes: wk text wrap top bottomwk text wrap squarewk text wrap square leftwk text wrap square right, and wk text wrap square largest.  

These wrapping settings are also preserved when exporting to SVG, PDF, and embedded HTML, and when importing or exporting Word documents.

SMART TABLE DESIGN & CELL MERGING

4D 21 brings two major improvements that make building and formatting tables in 4D Write Pro far easier for both developers and end-users.

The table wizard lets users generate tables from database data without needing to understand data sources or formulas. Using developer-provided templates, they can pick fields, translate labels, prepare business-specific formulas, and apply graphic styles, all through a guided interface.

Once the table is created, the new cell-merge capabilities give you full control over layout and structure. You can merge cells horizontally, vertically, or in blocks, whether the table is filled automatically or manually. Merges can be done through the interface (toolbar buttons and contextual menus), standard actions (cell/merge, cell/split), or by code using the new WP TABLE MERGE CELLS and WP TABLE SPLIT CELLS commands.

Together, these tools make it easier to design cleaner, more flexible tables that adapt to any document or data presentation need.

Unlimited Table rows and columns

4D 21 lifts the previous 1,000-row limit in 4D Write Pro tables. Tables can now grow as large as your machine’s available memory allows, making it possible to generate long invoices, catalogs, directories, and any data-driven document without artificial constraints.

When a table is linked to a datasource, every item in the entity selection or collection can now produce a row, even when headers, sort breaks, extra rows, or carry-overs are involved. This gives you full freedom to build large documents while keeping your layouts structured.

Manage Empty Datasources

4D 21 gives you more control over how tables appear when their linked datasource has no data. A new attribute, wk empty datasource, lets you decide exactly what should happen in that situation so your documents always look intentional and polished.

You can choose to:

  • Show the data row (default)

  • Hide the data row while keeping header rows and any following rows

  • Hide the entire table when it no longer provides meaningful content

  • Display a placeholder row designed specifically for empty states

Temporary visibility for hidden table borders

4D 21 makes it easier to work with tables by introducing the visibleTableBorders property, a view option that temporarily shows hidden borders as dotted lines. This helps you see the structure of your table, especially when cells are merged, without changing the final appearance of the document.

You can toggle this option directly from the toolbar or sidebar, giving you a clearer view while editing and ensuring layouts stay accurate and easy to manage.

Assign Names to Formulas

Formulas play a big role in 4D Write Pro documents, but until now their display, values, expressions, or symbols, could make templates harder to read. With 4D 21, you can assign names to formulas, giving users a clearer understanding of what each formula represents and making documents easier to maintain.

Instead of showing the formula itself, you can display a simple, meaningful label. This makes templates far more intuitive, especially when formulas get complex.

Two commands were updated to support this improvement:

  • WP INSERT FORMULA now accepts an object that includes both the formula and its name.

  • WP GET FORMULAS returns each formula along with its name, making it easy to inspect and manage formulas across a document.

 

Command syntax improvements

4D 21 brings a series of refinements to 4D Write Pro that make your code easier to write, easier to maintain, and much more flexible. Many commands now accept modern parameter types like objects and collections, several commands have been upgraded into functions that return useful results, and new helpers make it simpler to work with sections, pages, and tables.

Here’s a quick look at what’s new:

  • Cleaner attribute handling: You can now pass a single object to WP SET ATTRIBUTES, letting you apply multiple formatting properties at once.
  • More flexible table operations: WP TABLE APPEND ROW now accepts formulas, named formulas, and even complete collections of values.
  • Picture handling made easier: WP INSERT PICTURE is now a function that returns the inserted picture element. It also accepts 4D.File values, giving you more options for how images are stored and loaded.
  • Modernized import/export commands: Commands like WP IMPORT DOCUMENT, WP EXPORT DOCUMENT, and WP Add picture now work seamlessly with 4D.File. Additionally, WP INSERT DOCUMENT has been renamed to WP Insert document body to better reflect what it does.
  • Commands that finally return ranges: You now get a usable range back when inserting formulas, breaks, or document bodies.
  • Easy access to document structure: New functions like This.sectionIndex, This.sectionName, and This.pageIndex let you reference the current section or page directly inside formulas.

Control Email Formatting with Custom White-Space Options

Ensure clean and consistent email formatting by choosing the CSS white-space value during MIME export. This option helps avoid unwanted line breaks caused by certain mail clients misinterpreting white-space:pre-wrap, allowing you to use white-space:normal instead for better display compatibility.

 4D view Pro

4D View Pro gets a major boost with new ways to handle large spreadsheets, smarter Excel workflows, and more responsive, developer-friendly features. Compressed formats make heavy documents faster to load and store, custom functions become more powerful, SpreadJS upgrades expand what you can build, and improved import/export options keep your data accurate and easy to control.

COMPRESSED DOCUMENT FORMATS FOR BETTER PERFORMANCE

4D 21 introduces two ways to handle large, complex 4D View Pro documents more efficiently: the new .sjs compressed file format and support for importing and exporting documents as BLOBs.

The .sjs format is a lightweight, compressed structure made of multiple small JSON files, similar to Excel’s XML layout. It reduces file size, speeds up loading, and handles large spreadsheets more reliably. You can import and export it just like a standard .4vp file using VP IMPORT DOCUMENT and VP EXPORT DOCUMENT.

To complement this, 4D now supports a compressed BLOB format, giving you the same performance benefits directly in your database. Use VP EXPORT TO BLOB to store a document as a BLOB asynchronously, then reload it anytime with VP IMPORT FROM BLOB. This makes it easy to save, retrieve, and process heavy View Pro documents without relying on the file system.

Both formats are designed to improve performance, streamline storage, and ensure smoother handling of large View Pro content.

Enhancement of Custom Functions

4D 21 enables custom calculations on column or row contents within a spreadsheet without prior knowledge of the number of cells involved. This is made possible by allowing the passing of multiple cell ranges or objects to custom formulas, resulting in the retrieval of a collection or object containing all cell content within a 4D method.

SPREADJS 16.2 UPDATES & RIBBON ENHANCEMENTS

4D 21 introduces a major upgrade to 4D View Pro with the integration of SpreadJS 16.2 and an updated Ribbon designed to take advantage of its new capabilities.

Below are the new features for SpreadJS:

  • Formula Editor Panel for easier reading, editing, and debugging of long formulas.

  • Manual calculation mode to control when formulas recalculate.

  • Cross-sheet references while editing formulas.

  • PivotTable improvement: set subtotal positions per field.

  • New charting tools: Waterfall charts, smooth line formatting, and charts built from multi-selection ranges.

  • Lollipop Variance Sparkline for compact variance visualization.

  • Drag headers to move or insert rows and columns.

  • Additional Paste Special options (comments, validation, widths, formats…).

  • Sheet-tab styling with customizable colors and icons.

  • Pixel-based scrolling for smoother feedback.

  • Excel import keeps sort conditions for consistent results.

  • Workbook enhancements: show/hide zeros, password-protected sheets, default cell values, and inserting cut cells into tables.

Below are the new features for the updated Ribbon:

  • Direct Ribbon controls for formula editing, themes, colors, and fonts.

  • Options for moving/inserting rows and columns when drag-to-move is enabled.

  • Updated chart controls for quick creation and formatting using the new SpreadJS features.

Excel import/export IMPROVEMENTS

4D 21 makes working with Excel files in 4D View Pro more flexible by expanding the import and export options available in VP EXPORT DOCUMENT and VP IMPORT DOCUMENT.

On export, you can now decide exactly what goes into the generated workbook, binding sources, styles, formulas, merged cells, calculation data, unused names, and even whether headers should behave as frozen rows or columns. You can also add password protection and speed up workbook loading by including cached calculation data.

On import, new options help preserve formatting, formulas, frozen headers, and styles, while giving you control over recalculation, dynamic references, and open modes (normal, lazy, incremental). This ensures that Excel files load cleanly and consistently in your 4D View Pro interface.

All settings are organized in a single excelOptions object, making your code easier to read, maintain, and keep compatible with existing projects.

RELIABLE IMPORTS WITH CUSTOM FUNCTION SUPPORT

4D 21 ensures that import commands such as VP IMPORT DOCUMENT, VP IMPORT FORM BLOB, and VP IMPORT FROM OBJECT now trigger their callback only after all custom function calculations are finished. This gives you predictable timing for follow-up actions like printing, exporting, or saving.

The update also extends VP FLUSH COMMANDS, which now accepts an asynchronous callback that runs once all pending calculations are complete. This lets you queue operations safely without blocking the interface or risking incomplete results.

Together, these improvements make it easier to work with documents that rely on custom formulas, reducing errors and ensuring your workflow runs smoothly from import to final output.

security

4D 21 strengthens security at every layer, from encrypted communication to safer data handling and smarter certificate management. Automatic TLS certificates simplify deployment, expanded support for RSA and ECDSA keys modernizes your cryptographic options, and new CA validation tools help protect client-server traffic on untrusted networks. HTTPS requests can now draw credentials directly from the operating system, crypto signing works cleanly with both text and binary data, and session monitoring gives administrators a unified, real-time view of all active web activity. Even everyday tasks like pasting formulas benefit from safer defaults, while major library upgrades ensure your applications run on a current, hardened foundation.

Auto-Generated SSL/TLS Certificates for Client-Server Communications

4D 21 simplifies secure deployment by removing the old default SSL/TLS certificates that were bundled with 4D Server. Instead, when a server starts an application using encrypted connections, it now checks the Resources folder for user-provided certificates. If none are found, 4D automatically generates a temporary SSL/TLS certificate.

This means you no longer need to supply certificates just to enable encrypted client-server communication. Each server restart produces a fresh certificate, improving security while reducing setup steps. (Note: this does not apply to the web server, which still requires CA-validated certificates for browser compatibility.)

Expanded SSL/TLS Certificate Support with ECDSA

4D has long supported RSA certificates for securing SSL/TLS communication. With 4D 21, you can now also use ECDSA certificates, giving you a modern alternative that many platforms are increasingly adopting.

Whether you’re securing client-server communication or HTTPS requests, 4D 21 now accepts both RSA and ECDSA, no workflow changes required. Simply place your key.pem and cert.pem files in the expected locations, and 4D handles the rest.

Enhanced certificate authority validation for client-server SECURITY

4D 21 strengthens client–server security by allowing clients to verify server certificates against trusted certificate authorities (CAs). This ensures the server you’re connecting to is authentic and helps prevent man-in-the-middle (MITM) attacks.

To enable CA validation, you specify two values in buildApp.4DSettings:

  • the path to a file containing trusted CA signatures

  • the expected domain name of the server certificate

You can also provide a list of allowed domain names when multiple servers are involved. With this information, the client verifies that the server’s certificate is signed by a valid CA and matches the intended domain, otherwise, the connection is rejected.

This adds a critical layer of protection for deployments running over public or untrusted networks.

Use Windows Certificate Store Instead of Local Files blank

HTTPS requests can now pull certificates directly from the Windows keychain using the storeCertificateName parameter in the HTTPRequest and HTTPAgent class. This eliminates the need to store and manage certificate files locally.

System-level protection and centralized management replace manual file juggling. Certificate handling becomes more secure, consistent, and easier to administer across teams and machines.

FORCE LOGIN AS THE NEW DEFAULT FOR REST AUTHENTICATION

4D 21 now enables Force Login as the default security model for REST access. Instead of relying on older authentication mechanisms, every REST request now requires explicit login via the ds.authentify function.

New projects automatically include a roles.json file with forceLogin set to true, meaning no REST access is allowed until privileges are assigned. Existing projects can switch to this model through a dedicated button in the Structure Settings dialog, which updates legacy configurations and creates a roles.json file when needed.

This update brings all projects onto a modern, privilege-based security model that’s easier to maintain and far more precise. You can now manage permissions using the Qodly Studio Roles & Privileges editor and define exactly which parts of your datastore and functions are exposed.

Force Login ensures REST APIs are protected by default and gives you a clear, consistent way to control access across your entire application.

SIMPLIFIED CRYPTO SIGNING AND VERIFICATION WITH BLOB SUPPORT

4D 21 streamlines cryptographic workflows by extending 4D.CryptoKey.sign() and 4D.CryptoKey.verify() to accept both text and blob inputs. You no longer need to convert binary data into text, or vice versa, before signing or verifying it.

This makes it much easier to work with files, binary payloads, and structured data while keeping your signing and verification code clean and direct.

Unified Session Management for REST and 4DACTION blank

With 4D 21, you now have a comprehensive way to inspect all open web sessions, whether they originate from REST connections, SOAP calls, or 4DACTION requests.

  • All active sessions are listed in real time, giving administrators a transparent view of activity and resource usage.

  • Sessions can be labeled with usernames via Session.setPrivilege(), making it easy to identify connected users, trace actions, and manage licenses.

  • Sessions are thread-safe and automatically optimized, ensuring efficient resource use and reliable performance even under heavy load.

This provides smoother API execution at scale while giving developers and administrators clearer monitoring, stronger auditing, and improved stability.

SAFER PASTING for Formulas

To protect your data when working across different environments, 4D now pastes formulas from external sources as values only.

This applies to multi-style text fields and 4D Write Pro documents:

  • If the copied formula has never been executed, its source is pasted as plain text.

  • If it has been evaluated, only the resulting value (text or image) is pasted, never the underlying logic.

Formulas copied within the same application continue to paste normally. But when moving content between separate applications or environments, 4D automatically strips formulas to prevent unintended access to sensitive data.

Core Library and Dependency Upgrades blank

With 4D 21 LTS, we’ve upgraded Xerces, libldap, ICU, Chromium (CEF), OpenSSL, libZip, LZMA, ZLib, Libuv, BoringSSL, and PDFWriter—modernizing the entire stack to strengthen security, improve stability, and ensure compatibility with today’s platforms.

 4D language

The 4D programming language has undergone one of its biggest evolutions yet. Across the Feature Releases leading to 4D 21 LTS, it gains clearer syntax, safer error handling, modern class capabilities, stronger typing, real-time code validation, and richer tooling for REST, sessions, HTTP, data sync, and more.

Whether you’re building web services, manipulating data, structuring code, or optimizing workflows, the newer language features remove boilerplate, tighten safety, and make everyday development faster and more predictable.

Code Live Checker

4D 21 introduces the Code Live Checker, a real-time validation system that catches mistakes as you write. It checks syntax, class names, function names, parameter lists, and type compatibility, helping you spot typos, mismatches, and invalid references before they turn into runtime errors.

The checker runs in the background while you type and during syntax checks or compilation. It works with classes using dot notation and applies the same rules to component classes that include a syntax file. You’ll see warnings for inconsistent code and errors when something would fail at runtime, making your code safer and easier to maintain.

SINGLETONS ACROSS YOUR APPLICATION, SESSIONS, AND REST

4D 21 introduces singletons, a new way to create one object that’s accessible wherever you need it. Singletons can host interprocess values, central utilities, or even act as building blocks for patterns like factories, giving you a clean and reliable place to centralize shared logic.

You can define two core types:

  • Process singletons, unique to each process

  • Shared singletons, unique across the entire application

Creating one is straightforward: add the singleton keyword to a class constructor (or shared singleton for a shared version). From there, the singleton instance is always available through the me attribute, giving your application a single source of truth for whatever that class manages.

4D 21 also adds session singletons, which give each user their own isolated instance. They’re ideal in web and client-server environments where multiple processes handle requests for the same user. With session singletons, tasks like managing a shopping cart or a user-specific working list become simple and safe, because each session keeps its own state.

To round things out, shared singletons now integrate seamlessly with REST APIs and Qodly Pages. Any exposed function on a shared singleton can be called directly through REST, or selected as an event action in Qodly Studio, just like dataclass methods. Access remains fully controlled through roles and privileges, ensuring security and clarity in how your APIs operate.

Together, these features give you a consistent, scalable way to manage global values, per-user data, and shared application logic across every layer of your solution.

Simplifying Method Parameter Declarations

4D 21 streamlines how you declare method parameters. By using #DECLARE prototypes, you no longer need to repeat parameter declarations in separate compiler_ methods. The compiler now treats prototype declarations the same way it handles class function signatures, reducing redundancy and tightening type safety.

Existing code continues to work as before, but mismatched types between prototypes and legacy declarations now trigger errors, helping you catch issues earlier. You’ll also see warnings when parameters are declared twice or when a method is called with more arguments than the prototype allows.

This update saves time, removes clutter, and helps prevent runtime errors during compilation.

ONE-LINE DECLARATION & INITIALIZATION FOR VARIABLES AND PROPERTIES

4D 21 streamlines your code by letting you declare and initialize both variables and class properties in a single line. This removes boilerplate and makes intent clearer at a glance.

You can let 4D infer the type from the value:

var <variableName> := <value>
property <propertyName> := <value>
Or declare the type explicitly, useful for complex types or when you need full compiler clarity:
var <variableName> : <type> := <value>
property <propertyName> : <type> := <value>
Type inference works well for simple values, while explicit typing is safer for anything the compiler can’t deduce, such as class attributes, interprocess variables, or expressions with unknown types. This unified syntax removes clutter and helps you write clear, intentional code.

SIMPLIFIED Variadic Function DECLARATION

4D 21 makes it much easier to write functions that accept a flexible number of parameters. You can now use the “…” symbol as the final parameter in your declaration to indicate that the function accepts any number of arguments.

You can also attach a type, letting 4D verify that every incoming parameter matches your expectation:

#DECLARE(... : Real) : Real

Or leave it untyped if you want to accept anything:

#DECLARE(...)
This small addition removes a lot of overhead, making variadic functions clearer, safer, and more consistent to write.

MODERN, STRUCTURED ERROR HANDLING (TRY–CATCH, TRY(), THROW)

4D 21 gives you a cleaner, more predictable way to manage errors across your code. You can now raise errors deliberately, catch them exactly where they occur, and recover gracefully—without global handlers or unexpected dialogs interrupting the flow.

  • Try–Catch blocks for controlled recovery: Wrap multiple statements inside Try … Catch … End try. If anything inside the Try block fails, execution jumps straight to Catch. No dialogs appear, and ON ERR CALL isn’t triggered. This lets you roll back work, log details, or continue with a fallback path in a structured, readable way.

  • Try(Expression) for inline error handling: Run a single expression and handle failures right next to the code that caused them. Try() returns the result when successful or undefined when an error occurs. You can check Last errors immediately, using the same variables and context, keeping error logic tight and local.

  • throw for raising custom errors: Use the new throw command to signal problems at the exact moment they appear, invalid state, broken assumptions, or business rules that must stop execution. These errors behave exactly like native 4D errors and can be caught with Try(), Try–Catch, or ON ERR CALL. You can raise simple messages or reuse XLF-based error definitions with placeholders.

Together, these tools give you a unified, modern error model, clean to write, easy to follow, and safe for every part of your application logic.

Incremental Synchronization with Global Stamps

4D 21 expands the global stamp system, originally introduced for 4D for Mobile, to any workflow that needs incremental synchronization. Instead of transferring full datasets, you can now sync only the records that have changed since the last update.

Once data-change tracking is enabled, 4D automatically assigns a stamp to every created, modified, or deleted record. Two functions give you full control:

  • .getGlobalStamp(): Retrieves the datastore’s current modification stamp so you can track what has changed over time.

  • .setGlobalStamp(): Lets you update stamp values manually when you need to override the default behavior.

Because stamps reflect every data modification, they make it easy to query what changed, detect deleted records, and perform fast, reliable incremental sync through the 4D REST Server, without relying on full SQL replication.

SYNC MULTIPLE COLLECTIONS WITH MULTISORT()

Working with several related collections, especially when data comes from outside 4D, can make sorting and keeping everything aligned a challenge. In 4D 21, the new multiSort() function solves this by letting you sort multiple collections in sync with a single call.

You can:

  • Sort one collection and automatically reorder others to match

  • Apply custom sort formulas

  • Define multi-level sorting rules

  • Work with both simple values and objects

  • Keep stable ordering when values are equal

Whether you’re aligning arrays received from external systems or coordinating several collections in your app, multiSort() makes the whole process faster, cleaner, and more reliable.

SIMPLE Reference Comparison for Objects & Collections

4D 21 makes it much easier to check whether two objects or collections point to the same reference in memory. You can now use the = and # operators to compare references directly, instead of comparing content.

This gives you a quick way to see whether two variables refer to the exact same object or collection, especially helpful when you’re working with shared references, nested structures, or arrays of objects.

You can also use these comparisons in array functions, queries, and other operations, making reference handling more consistent across the language.

SIMPLIFY SHARED OBJECTS WITH SHARED CLASSES

4D 21 introduces shared classes, a streamlined way to work with shared objects without manually managing Use…End use blocks.

By adding the shared keyword to a class constructor, every call to new() automatically creates a shared object. You can also mark class functions as “shared” to indicate that they modify the underlying shared object. When you do, 4D automatically handles the locking workflow, making shared-object code feel as natural as working with regular objects.

Shared classes make it easier to run tasks in workers, coordinate state between processes, or store shared results safely. Just keep in mind that while non-shared classes can inherit from shared ones, the reverse isn’t allowed, so plan your class hierarchy accordingly.

CLIENT/SERVER SESSION SUPPORT IN THE SESSION COMMAND

4D 21 expands the Session command so it now covers Client/Server connections and stored procedures, in addition to the existing Web and Mobile sessions in 4D applications. This gives you a unified way to access session-level information across all execution contexts.

A new ClientServerSession class is available for 4D Remote sessions, giving you access to key properties:

  • id: the unique session identifier

  • info: machine, user, and environment details

  • storage: a shared object available to all processes in the same session

  • userName: the user associated with the session

This makes it easy to share data between processes, track user-specific context, and write generic session-aware code that behaves consistently whether running in web, mobile, client/server, or stored procedure environments.

ACCESS SESSION STORAGE ACROSS ALL SESSION TYPES

Keeping user data consistent across different parts of your application, client/server, web, mobile, used to require extra work. Each session kept its own storage, and there was no simple way to reach into another session to retrieve shared information.

4D 21 solves this with a new command: Session storage by id. It lets you access the storage of any session in your application, no matter how it was created. Once you have the session ID, you can read or update its shared storage just like your own.

This makes it easy to maintain continuity for users working across multiple environments. For example, you can store a customer record when a user logs in through the web app and access that same record later from a client/server session, keeping the experience seamless and consistent.

INSPECT SESSION PRIVILEGES FOR SECURE, EASY DEBUGGING

Controlling what users can access is a key part of securing your application. With 4D 21, you now have better visibility into those permissions thanks to an enhancement to session privileges.

Privileges, assigned through roles during authentication, determine which actions a user is allowed to perform. To make debugging easier, you can now inspect these privileges directly in the session using the new getPrivileges() function. This gives you a clear view of which permissions are active at any moment.

There’s also a new REST endpoint (/$info/privileges) that returns the same information, making it simple to verify access rights across different environments.

These additions help you confirm that your security rules are working as expected and ensure users only access the data and features intended for them.

IMPROVED PROCESS AND SESSION MANAGEMENT

4D 21 makes it easier to inspect, track, and manage processes and sessions, giving you more control and clearer visibility across your application. Several commands have been enhanced or added to streamline how you retrieve information and monitor activity.

Here’s what’s new:

  • Process info now returns a full object, making process properties easier to read and use. It also includes a new creationDateTime property so you can track when each process was created.

  • Session info lets you fetch session details directly from a session ID, avoiding extra steps or additional lookups.

  • Process number has been updated so you can retrieve a process number not only from its name but also from its process ID.

  • Process activity now supports filtering by session ID, allowing you to quickly list only the processes tied to a specific session—useful when debugging or monitoring users.

Simplified Session Management for Development and testing

With 4D 21, session handling becomes much smoother during development. The Session command now returns a valid object even in standalone and single-user environments, removing the need for extra checks or fallback logic.

This update makes it easier to work with session data, test role-based restrictions, and simulate Client/Server behavior, all without switching environments or adding workaround code.

In standalone mode, you can now use:

  • Session

  • Session info

  • Session storage

These simulated sessions are meant for development and testing, letting you build and debug features such as authentication, data filtering via the Restrict event, or shared session storage, just as you would in a Client/Server setup.

For production standalone applications, you’ll still rely on Storage for user-specific data, but for development, this change streamlines your workflow and improves consistency across environments.

MORE FLEXIBLE FORMULA EXECUTION WITH “FORMULA FROM STRING”

4D 21 expands how Formula from string works by letting you choose the execution context. This makes component development much easier, especially when formulas need to call methods or access variables defined in the host database.

Previously, formulas always ran in the context where they were created, which meant a component couldn’t execute formulas referencing non-shared methods in the host project. Now, you can decide where the formula should run:

  • sk execute in host database: Run the formula in the host project, allowing access to its methods and variables.

  • sk execute in current database: The default behavior, keeping execution inside the component.

This small addition unlocks much more flexible component design and lets you build features (like custom 4D Write Pro interfaces) that seamlessly call into the host database.

MORE FLEXIBLE LOG FILE MANAGEMENT

4D 21 gives you more control over how your application manages its log (journal) file during deployment.

You can now override the Use log file setting the same way you override other backup parameters. When this option is enabled, 4D prompts you to create or select a log when a new data file is created, and it stores that path inside the data file. If you later open a data file that has no log while the option is active, 4D will ask you to create or select one.

Previously, this setting was always stored in the catalog file. Now, you can decide where it comes from by using a backup parameter file, placed next to the structure, next to the data, or inside the structure itself. This gives you more flexibility when deploying to different environments without changing your main project files.

PHP Commands Deprecation & REMOVAL of the Built-In Interpreter Removal

PHP once filled important gaps in 4D’s web development, handling tasks like ZIP, hashing, or LDAP before the language offered native solutions. As these capabilities became part of 4D itself, the built-in PHP interpreter was removed in 4D 20 R3, and the PHP command set begins its deprecation phase in 4D 21.

PHP Execute continues to work, but now requires an external PHP interpreter. This gives you more flexibility to update PHP versions, apply security patches, and load additional modules. For long-term use, the recommended approach is to run PHP code through system workers, which provide full control over how PHP is launched and managed.

The commands remain available for compatibility, but new development should move toward system-worker-based execution to ensure easier maintenance and future stability.

Custom date and time formats

When you need dates and times to match specific regional or project requirements, the default system formats aren’t always enough. With 4D 21, you can now define precise custom formats, whether you’re displaying values in forms or transforming them into strings.

This update introduces flexible formatting options through:

  • The String command, now supporting fully custom format strings.

  • The OBJECT SET FORMAT command, letting you apply custom formats directly to form objects.

  • The interface, which now includes a “Custom” option for defining patterns visually.

You can control everything, from quarter numbers and week numbers to localized day names and detailed time expressions, using a single shared formatting syntax. This gives you complete control over how dates and times appear in documents, interfaces, and generated text.

 

Export Structure Definition AS HTML

4D 21 simplifies how you share structure definitions by exporting them directly as HTML. Previously, the export relied on an XML+XSL pair that browsers rendered as HTML, but modern browser security blocks local files from loading certain external resources.

With the updated export, selecting File → Export → Structure definition to HTML… now produces a standalone HTML file that opens cleanly in any browser. All required assets are placed in an accompanying html_export_resources folder, which you can customize if needed.

You can also export in HTML programmatically using EXPORT STRUCTURE with its optional parameter, giving you the choice between XML and HTML formats.

DYNAMIC FORMULAS FOR FORM OBJECTS

With 4D 21, form objects become far more flexible thanks to formula-based data sources. Instead of binding an object to a fixed field or pointer, you can now connect it directly to a formula using OBJECT SET DATA SOURCE FORMULA.

This lets values update automatically based on calculations, context, or other dynamic logic, perfect for building adaptable forms or generating UI elements on the fly.

Pair this with listbox constants like lk selected items expression and you get form behavior that adapts in real time, reducing code duplication and improving responsiveness.

Hexadecimal String to Number Conversion blank

The String command now lets you convert hexadecimal strings directly into numbers. No more writing parsing utilities or dealing with binary string tricks. Just pass the string, and you get the numeric result.

It’s a subtle addition that removes friction when working with external APIs, low-level formats, or integrations returning hex.

New String Trim Functions blank

New commands, trim, trimStart, and trimEnd, make it easier to strip whitespace or specific characters from strings. They behave like their JavaScript or Python equivalents and work with any character set.

Manual trim logic is no longer necessary. Data is cleaner, form inputs are easier to validate, and code aligns with expectations across modern languages.

Improved Catalog Management in Version Control Systems

Before, all project details, like colors and positions of tables, fields, and relations, were stored in catalog.4DCatalog. Now, this info is split into a separate file called catalog_editor.json.

This makes managing changes and reviewing work easier, especially when multiple developers are involved. With this change, the catalog file stays untouched when someone adjusts a table or field.

This helps prevent conflicts and makes reviewing changes simpler. Plus, we’ve added an option to switch to this new setup for older projects. If you accidentally turn on this feature, don’t worry! You can easily undo it by reverting to the old setup.

Simplify variable declarations with direct typing

The new direct typing feature in 4D 21 simplifies variable declarations by eliminating the need for “Compiler” methods.

This change lets developers declare process and inter-process variables directly in their code, enhancing organization and encapsulation. Instead of relying on type inference, which can slow compilation and lead to errors, the compiler pauses when encountering an untyped variable, ensuring type safety without sacrificing efficiency. Direct Typing is enabled by default for new projects, and existing projects can easily toggle the feature in the compiler settings for a smooth transition. This marks a significant improvement in flexibility and control for 4D developers.

Improved debugging Experience

4D 21 brings significant improvements to the debugger and remote debugger.

With auto-saved expressions, you no longer need to re-enter previously evaluated expressions, ensuring a better debugging experience. The new “pin” feature lets you keep essential expressions always accessible.

You also get more control with Local Variables, Line Expressions, and Custom Expressions in the expression watcher.

Finally, the redesigned interface offers a cleaner, more intuitive debugging environment.

 Code & Form Editor

The 4D development environment has taken a major step forward. Across the Feature Releases leading to 4D 21 LTS, the Code and Form Editor gain smarter warnings, stronger validation, cleaner editing tools, and better visibility into potential issues long before they reach runtime.

Whether you’re refining business logic, building dynamic interfaces, or maintaining large codebases, these enhancements help you focus on what matters, writing clear, reliable code. By reducing noise, catching mistakes earlier, and streamlining navigation through forms, the editor now supports a faster and more predictable development workflow.

Customize Global Warning Display

    As projects grow, the number of warnings in your code can expand quickly. Some are essential guardrails, while others may not apply to your coding style or architecture. With 4D 21, you now have full control over which warnings matter to you.

    You can define, at the project level, which warning types should appear in the code editor and compiler dialog. This lets you hide warnings you consider irrelevant and keep attention on the ones that truly help you catch problems early.

    You still have local control, too. Even if a warning is globally shown or hidden, you can enable or disable it around specific sections of code using the familiar //%W+ and //%W- switches.

    This flexibility makes it much easier to stay focused, reduce noise, and tailor the warning system to the way you build your applications.

    Warnings for Deprecated Language Elements

    4D 21 helps you keep your code modern by alerting you when you use deprecated language elements. Commands, constants, parameters, and typing directives that are no longer recommended now trigger warnings, for example:

    • C_LONGINT($1)

    • C_BOOLEAN($draw)

    • _O_USE INTERNAL DATABASE

    These elements still work, but they won’t appear in code completion anymore, encouraging you to move toward newer, supported syntax.

    If you prefer, you can turn these warnings off in the structure settings.

    To make introspection easier, the Command name command now returns deprecation details in addition to thread-safety information, so you can quickly check whether a command should be updated.

    SMARTER, REAL-TIME SYNTAX CHECKING FOR FORMS

    4D 21 brings deeper, more intelligent syntax checking to forms, helping you spot issues earlier and write cleaner code with less trial and error.

    You can now associate a class with a form, which means expressions like Form.myProperty are fully validated. The editor checks these expressions as you type, both in method code and in the property list, so errors surface immediately rather than during compilation.

    When you open a form with DIALOG, 4D also instantiates the associated class automatically when no object is provided. This makes the Form object predictable and consistent without extra setup.

    To help you move faster, the code editor now offers auto-completion for Form, listing class properties and functions so you avoid mistyped names and benefit from clearer, more discoverable code.

    Improved FORM EDIT Command

    4D 21 makes form editing faster and more intuitive by extending the FORM EDIT command. You can now open a form and automatically select a specific object within it, letting you jump straight to the element you need to inspect or adjust.

    This is especially useful when working with analysis tools, error reports, or refactoring utilities. Instead of navigating through multiple form pages to locate an object, a single command takes you directly to it:

    FORM EDIT($formName; $objectName)
    By selecting the object immediately, even inside groups, you get instant access to its properties, speeding up debugging and cleanup work.

     Visual Studio code extension

    AI supported development is becoming part of everyday coding. From writing code and spotting errors to generating complete 4D forms with CSS, form classes, and form methods, AI changes how fast you move. With Copilot inside Visual Studio Code and full support from the 4D Analyzer and 4D Debugger extensions, you can use AI confidently while keeping your code clean, validated, and easy to debug. This is not just about AI assisted coding. It is about giving you a smarter, faster, and more controlled development workflow.

    Format your 4D Code in Visual Studio Code

    4D 21 brings a welcome improvement to the VS Code extension: built-in code formatting.

    If you often edit 4D methods or classes in VS Code, you’ll now get formatting that matches the style used inside 4D, making both environments feel consistent and easier to switch between.

    You can format an entire file or just a selection, just like you would with other languages in VS Code. The formatter handles indentation, spacing, and the character case of commands, keywords, and constants, while respecting your VS Code indentation settings.

    Show 4D documentation DIRECTLY IN VS CODE

    The 4D-Analyzer extension adds a handy shortcut for looking up documentation while you code in Visual Studio Code editor.

    When you hover over a 4D command, class, or class function, a tooltip now appears with a brief description. At the bottom, a “Show 4D Documentation” link takes you straight to the full page in the official 4D docs, opened automatically in your browser.

    Workspace Syntax Checking

    The 4D-Analyzer extension brings full Workspace Syntax Checking to Visual Studio Code. Instead of validating only the file you’re editing, VS Code can now scan your entire 4D project and highlight issues instantly.

    Errors and warnings appear in VS Code’s Problems panel, grouped by 4D method or class. A single click takes you straight to the exact line, making cleanup fast and predictable. Inline highlights and tooltips also help you understand issues right where they occur.

    Automatic Tool4D Download

    With version 0.2.0 of the 4D-Analyzer extension, rather than manually installing a 4D application and entering its path in the extension’s parameters, the extension automatically downloads a version of tool4d, stores it in a location on the system, and launches it in the background. This simplification aims to streamline the process of getting started and enhance development with VS Code for 4D.

    GitHub Codespaces

    GitHub’s Codespaces simplify remote development by enabling the editing of repositories from anywhere via Visual Studio Code or the Codespaces application.

    With the integration of 4D projects, developers can enhance their coding experience with tools like 4D-Analyzer, which offers features such as code highlighting and auto-completion. As seen in the section above, 4D-Analyzer automatically downloads and updates the version of the tool4d application you have defined. 4D has released a dedicated version, tool4d, for GitHub to enable this in a Codespace environment.

    Debugging 4D Code Directly in Visual Studio Code

    4D 21 introduces the new 4D-Debugger extension for Visual Studio Code, enhancing debugging with powerful features like setting breakpoints, stepping through code, and inspecting variables, all directly within VS Code. This tool builds on the 4D-Analyzer and integrates smoothly, making debugging faster and more intuitive.

    Install the 4D-Debugger extension from the VS Code marketplace. Ensure a 4D Server is running on your machine, and configure the connection in the .vscode/launch.json file. You can also attach to an existing server using the default debugger port.

     User Interface

    From window customization to better scrolling, icon control, and cleaner version-controlled catalogs, the UI layer of 4D 21 has become more flexible and developer-friendly. These enhancements help you build interfaces that feel polished and modern while also simplifying collaboration, debugging, and maintenance behind the scenes.

    Customize App Appearance with New Windows Types

    Two new window types allow you to design the window title bar yourself and add your own elements, such as buttons or a search box. This means complete freedom to tailor your application’s appearance to your specifications.

    But that’s not all! We’ve also introduced several new commands designed to streamline your development process:

    • Reduce a window in the title bar on Windows or the dock on macOS, REDUCE RESTORE WINDOW
    • Know if the window is reduced in the title bar on Windows or the dock on macOS, Is Window Reduced
    • Know if the window is maximized, Is Window Maximized.

    Custom icons for every window type

    The SET WINDOW DOCUMENT ICON command lets you define a custom icon for each window type, improving user navigation and experience. Using the command syntax, you can set an icon or document for a window, making your interface more visually appealing. The icon will be visible in the window and Windows taskbar, providing clear visual cues. This feature also supports associating icons with documents, offering additional customization options.

    Enhanced Scrolling Behavior in Subforms

    4D 21 makes working with subforms in your applications much smoother and more intuitive for users!

    Have you ever gotten frustrated trying to scroll through a list in a subform, only to have the entire subform move instead? Or maybe you’ve attempted to scroll the subform, but the list box won’t budge?

    4D 21 fixes this with a new, improved subform scrolling behavior.

    Introducing “blank if null” for time columns and footers

    With 4D 21, the “Blank if null” property is now available for “time” type columns and footers in listboxes, addressing a long-standing limitation.

    You can easily define the display behavior through the display theme or by programming. This enhancement allows for clearer and more intuitive results, whether you use a simple checkbox or a line of code.

    Custom Parameters for Initializing Embedded Web Area

    4D 21 makes it easier to customize the embedded web area in your applications! This area uses Chromium for browsing, and developers sometimes need to adjust how Chromium works.

    Previously, this required complex code changes. Now, with 4D 21, you can simply create a file named “4DCEFParameters.json” and specify the customizations you want in that file. This makes managing it much easier and ensures your customizations are applied correctly.

    For example, this feature allows videos to play automatically in your web area, which wasn’t possible before.

    Use a Class in Embedded Web Areas with $4d

    Control access to 4D methods in your web areas by defining exactly which functions are exposed through $4d. With the new WA SET CONTEXT command in 4D 21, you can encapsulate and restrict available functions using class methods or object-based contexts, enhancing security, improving code organization, and simplifying maintenance.

    Improve Formula Editing and Security in Label Wizard

    4D 21 improves the Label Wizard component, making it easier and safer to insert and modify formulas in your labels. Now, you can quickly add formulas using a dedicated button or menu item, and validate them directly in the Formula Editor.

    This update enhances security by filtering out malicious formulas and ensures the creation of valid formulas by blocking disallowed commands. Editing is simplified too, just double-click to open the formula and make changes.

    Non-blocking Printing

    4D 21 introduces non-blocking printing, enabling simultaneous execution of multiple print jobs for enhanced application responsiveness. The default activation in new projects ensures a seamless experience, but older applications need to enable it in the compatibility options of the structure settings.