logologo
Get Started
Guide
Development
Plugins
API
English
简体中文
Get Started
Guide
Development
Plugins
API
English
简体中文
logologo
Workflow
Overview
Getting Started

Triggers

Overview
Collection Event
Schedule
Pre-action Event
Post-action Event
Custom Action Event
Approval
Webhook

Nodes

Overview

AI

Large Language Model

Flow Control

Condition
Loop
Variables
Parallel Branch
Subflow
Output
Delay
End

Calculation

Calculation
Date Calculation
JSON Query
JSON Variable Mapping

Data Operations

Create Data
Update Data
Query Data
Delete Data
SQL Operation

Manual Processing

Manual Processing
Approval
CC

Extended Types

HTTP Request
JavaScript
Notification
Send Email
Response
Response Message
Variables
Execution History
Version Management
Advanced Options

Extension Development

Overview
Extending Trigger Types
Extending Node Types
API Reference
Previous PageEnd
Next PageDate Calculation

#Calculation

The Calculation node can evaluate an expression, and the result is saved in the result of the corresponding node for use by subsequent nodes. It is a tool for calculating, processing, and transforming data. To some extent, it can replace the function in programming languages of calling a function on a value and assigning it to a variable.

#Create Node

In the workflow configuration interface, click the plus ("+") button in the flow to add a "Calculation" node:

Calculation Node_Add

#Node Configuration

Calculation Node_Configuration

#Calculation Engine

The calculation engine defines the syntax supported by the expression. The currently supported calculation engines are Math.js and Formula.js. Each engine has a large number of built-in common functions and methods for data operations. For specific usage, you can refer to their official documentation.

Tip

It should be noted that different engines differ in array index access. Math.js indices start from 1, while Formula.js starts from 0.

In addition, if you need simple string concatenation, you can directly use "String Template". This engine will replace the variables in the expression with their corresponding values and then return the concatenated string.

#Expression

An expression is a string representation of a calculation formula, which can consist of variables, constants, operators, and supported functions. You can use variables from the flow context, such as the result of a preceding node of the calculation node, or local variables of a loop.

If the expression input does not conform to the syntax, an error will be prompted in the node configuration. If a variable does not exist or the type does not match during execution, or if a non-existent function is used, the calculation node will terminate prematurely with an error status.

#Example

#Calculate Order Total Price

An order may contain multiple items, and each item has a different price and quantity. The total price of the order needs to be the sum of the products of the price and quantity of all items. After loading the list of order details (a one-to-many relationship dataset), you can use a calculation node to calculate the total price of the order:

Calculation Node_Example_Configuration

Here, the SUMPRODUCT function from Formula.js can calculate the sum of products for two arrays of the same length, which yields the total price of the order.