Node - Rollup
Function: Queries records matching specified conditions in a worksheet and performs aggregations (e.g., number of records, sum, average, max or min values).
Note: No data volume limits, but delays may occur with frequent data updates.
Use Case:
-
Query order details for a specific order and sum subtotals.
-
Query tickets from the past month and calculate average response time and total ticket count.
Aggregation Methods
-
Summary from worksheet
Query records and aggregate field data (max/min/avg, or counts of filled/unfilled items).
-
Get records count
Retrieve records via "Get Multiple Data" node first, then calculate the total count.
I. Summary from worksheet
Query records in a worksheet that meet specified conditions, then:
- Count the records
- Calculate sum, max, min, or average of number fields
- Count filled/unfilled items
Use Case 1: Aggregate the count and average response time of tickets from the last month
-
1. Add a Rollup node and select "Summary from worksheet"
-
2. Add filters to target ticket records
-
Aggregate "Number of records"
If "When the summary result is empty, it is considered as 0" is checked, queries with no matching records return 0.
-
4. Access mode
-
Direct access
Aggregate and save results when the workflow reaches the rollup node. Results remain static even if source field data changes.
-
Dynamically acquired data each time
Defers aggregation until results are actually used by subsequent nodes. Results may vary if source field data changes.
-
-
5. Add another Rollup node to calculate average response time
Use same filters as above, and select the "Response Time" field and "Average" aggregatio.n
-
6. Use aggregation results in subsequent nodes
Use Case 2: Sum subtotal fields in order details records
If it is multiple records obtained through associated records, it cannot be summed up, but you can select the rollup node to query and sum it up directly.
-
1. Add a Rollup node and select "Summary from worksheet"
-
2. Query the Order Details worksheet
-
For subforms, only physical worksheets can be queried.
-
Filter: When the Order worksheet is related to the Order Details worksheet, filter records where: "Related Order (Order Details worksheet) = Record ID (Order worksheet) "
-
-
3. Aggregation field
Select the "Subtotal" field in Order Details.
Choose "Sum" as the aggregation method.
-
4. Use aggregation results in subsequent nodes
In the subsequent nodes, select the aggregation result if needed.
Use Case 3: Sum total expenses after batch selecting records
Batch operation buttons allow triggering workflows after selecting multiple records. As shown below, after batch selecting expense records, clicking the button triggers a workflow that aggregates the selected data sources via a rollup node.
- Requires a batch operation button with a multi-record data source.
- Add a Rollup node and select "Aggregate Batch Data Source".
This method is only available in workflows triggered by batch operation buttons.
- Sum the amount field from the data source records.
The trigger node represents the selected multiple records.
II. Get data count
In this method, the aggregation target node can only be a "Get multiple data" node. The objects to be aggregated can be either records from a worksheet, or array data returned by a "Code Block" or "Send API Request" node.
Use Case: Count the number of incomplete tasks under a project record.
-
1. Add a "Get multiple data" node
Use worksheet relationships to retrieve incomplete tasks under the project.
-
2. Add a Rollup node and select "Get data count"
-
3. Aggregation objects
-
Object: Select the previous "Get Incomplete Tasks" node and count these task records.
-
[Limit results based on the number of summary objects]
If the "Get Mmultiple data" node finds 135 matching records but is configured to fetch max 100 records:
Check "Limit results based on the number of summary objects": Returns 100.
Uncheck "Limit results based on the number of summary objects": Returns 135.
-
-
4. Use aggregation results
Write the results directly to worksheet fields or set branches depending on the results.