How YunFengDie’s Excel‑Like Formula Engine Powers Low‑Code Form Automation
This article explains how Ant Group's YunFengDie low‑code platform implements an Excel‑style formula system—including syntax design, variable handling, compiler, validator, and executor—to enable non‑technical users to create dynamic business rules within forms.
Editor’s note: The author, a former Ant Group front‑end engineer, introduces YunFengDie’s Excel‑like formula system, a no‑code/low‑code platform for building standard applications for Ant employees.
What Are Formulas?
When mentioning Excel formulas, most people know the simple SUM function used to calculate the sum of a range of numbers.
Excel users can use formulas to aggregate, sort, filter data, and even adjust table layouts; in short, Excel formulas inject dynamic data generation capability into static tables.
Formulas in YunFengDie Applications
YunFengDie is Ant Group's internal platform for building forms, processes, and pages without writing code, allowing business users to create and deploy forms and analyze collected data independently.
Example: when the applicant enters an employee ID, the applicant name field automatically displays the corresponding name.
Each form submission creates a new instance consisting of four fields (employee ID, name, department, reason), which can be viewed as an Excel‑like sheet.
By switching the "Applicant Name" field to "Formula Binding" and configuring a formula, the platform provides a low‑technical‑barrier data‑collection capability and enables writing dynamic business rules.
In short, YunFengDie offers low‑entry data‑collection abilities, and its formula system adds the capability to write dynamic business rules.
Core Requirement: Low Learning Curve
The formula system is designed for users without coding experience, emphasizing simplicity and ease of use.
Product Form
Formula Editing
Like Excel, formulas process data and output results; in the form scenario, users employ built‑in functions to write business logic for form fields.
Built‑in processing functions : handle text, numbers, complex logic, data retrieval, etc.
Form fields as variables : expose current form field values as formula parameters.
Low‑barrier logic editor : provides syntax highlighting, hints, and validation.
Formula Execution
Formulas automatically recompute when dependent variables change, similar to reactive frameworks.
Main Capabilities
YunFengDie’s formula features combine strengths from various platforms.
❌ Not supported ✅ Supported ✅💯 Excellent
How to Build a Formula System?
A complete formula system includes syntax, variable, and material specifications.
Specification Definition
Syntax Specification
The syntax is kept simple: binary operators (e.g., A + B) and function calls (e.g., SUM(1, 2, 3)).
Few operators : only binary operations and method calls.
Few data types : users only need to understand basic text, time, number, and collection types.
Built‑in logic : loops, branches, and data requests are abstracted as functions, hiding async concepts.
Variable Specification
Variables bridge the formula system and business logic, defining name, schema, and compiled expression.
Variable name : business variable identifier used in formulas.
Variable schema : declares data type and structure for editor validation.
Compiled expression : defines how the variable is transformed into executable code after compilation.
Material Specification
Materials are the core extensibility of the formula system; complex platform logic can be encapsulated as functions for user consumption.
Basic definition : function name, description, documentation, examples displayed by the editor.
Type definition : parameter and return type definitions used for validation and editor hints.
Implementation : internal logic executed by the runtime engine.
Capability Implementation
Compiler
Regardless of the formula syntax, it must be compiled into executable code; YunFengDie uses an AST and Antlr to translate formulas into JavaScript.
// User formula: IF(变量A = "单凉", USERINFO("单凉", "work_id"), "000000")
IF(变量A = "单凉", USERINFO("单凉", "work_id"), "000000")
// Compiled output:
IF(
doCalc(vars.A1234, "===", "单凉"),
await USERINFO("单凉", "work_id"),
"0000"
)The compiler traverses the AST, converts special syntax nodes, and generates the target code text.
Validator
The validator checks each AST node against defined schemas, such as function signatures and variable types.
Executor
After compilation, the executor injects variable and function values into the runtime environment to obtain results, and uses a reactive mechanism (e.g., Proxy) to re‑execute formulas when inputs change.
// Variable A changes from 1 to 10
1 => 10
// Configured formula: f(x) = A + 5
6 => ???Business Integration
When business systems need non‑developers to write dynamic rules, define business‑side functions (e.g., e_search, e_set), build variable lists, and generate runtime code (e.g., Java) using the formula system.
Following these steps can add rule‑writing capability with minimal development effort.
Alipay Experience Technology
Exploring ultimate user experience and best engineering practices
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
