Skip to main content

Node - Rollup


Overview

The Rollup node queries and aggregates worksheet data. You can use it to count records, calculate the sum, average, maximum, or minimum of a field, or count records where a field is filled or empty.

There is no limit to the number of worksheet records that can be included in a rollup. If the source data changes frequently, there may be a slight delay before the latest data is reflected in the result.

Common use cases include:

  • Calculate an order total by summing the Subtotal values of its line items.
  • Calculate the average response time of support tickets from the past month.
  • Count the number of support tickets created in the past month.

Rollup Methods

The Rollup node supports two methods:

  • Summary from Worksheet: Query records directly from a worksheet and aggregate the matching data. You can calculate values such as sum, average, maximum, and minimum, or count records and filled or empty field values.

  • Get Data Count: Count the number of data items returned by a Get Multiple Data node.

Summary from Worksheet

Use this method when you need to query records directly from a worksheet and aggregate the matching data.

You can count matching records, calculate the sum, average, maximum, or minimum of a numeric field, or count records where another field is filled or empty. There is no limit to the number of worksheet records included in the calculation.

Example 1: Count Tickets and Calculate Average Response Time

In this example, the workflow counts the tickets from the past month and calculates their average response time.

1. Add a Rollup Node

Add a Rollup node and select Summary from Worksheet.

2. Define the Records to Include

Add filter conditions to include only tickets from the past month.

3. Count the Matching Records

Select Number of Records as the value to calculate.

Enable When the summary result is empty, it is considered as 0 to return 0 when no records match the filter conditions.

4. Choose When to Calculate the Result

  • Direct access

    Calculates and stores the result when the workflow reaches the Rollup node. Subsequent changes to the source data do not affect the stored result.

  • Dynamically acquired data each time

    Calculates the result only when it is referenced by a subsequent node. The latest source data is used each time the result is referenced, so different subsequent nodes may receive different results if the source data changes between references.

5. Calculate the Average Response Time

Add another Rollup node with the same filter conditions. Select Response Time as the field and Average as the aggregation method.

6. Use the Result

In a subsequent node, select the result returned by the corresponding Rollup node.

Example 2: Calculate an Order Total

Suppose an order has multiple related line items and you need to calculate the sum of their Subtotal values.

Related records retrieved through a relationship cannot be passed directly to this Rollup method for aggregation. Instead, query the related records directly from the worksheet and aggregate them in the Rollup node.

1. Add a Rollup Node

Add a Rollup node and select Summary from Worksheet.

2. Query the Order Line Items

Select the Order Line Items worksheet and define which records to include.

  • Data Source: Query the records directly from the worksheet. If the data comes from a subform, the subform must be stored as an entity worksheet before its records can be queried.

  • Filter Conditions: Because Orders and Order Line Items are connected by a relationship field, set the relationship field equal to the current order's record ID to retrieve its line items.

3. Configure the Aggregation

Select Subtotal as the field and Sum as the aggregation method.

4. Use the Result

Reference the result returned by the Rollup node wherever the order total is needed in subsequent nodes.

Example 3: Calculate the Total for Selected Expense Records

A custom action available for bulk actions can trigger a single workflow execution for multiple selected records.

For example, users can select multiple expense records and run a custom action to create a reimbursement request. The Rollup node can calculate the total amount of the selected expenses.

1. Configure the Custom Action for Bulk Actions

The custom action must be available for bulk actions so that the selected records are passed to the workflow as its data source.

2. Add a Rollup Node

Add a Rollup node and select the method for aggregating batch data source.

This method is available only in workflows triggered by a custom action configured for bulk actions.

3. Calculate the Total Amount

Select Amount as the field and Sum as the aggregation method.

The trigger node contains the records selected when the custom action was run, allowing the Rollup node to aggregate their values directly.

2. Get Data Count

Use this method to count the number of data items returned by a Get Multiple Data node.

The data can be worksheet records or array data returned by nodes such as Code Block and Send API Request.

Example: Count Incomplete Tasks in a Project

In this example, the workflow retrieves the incomplete tasks associated with a project and counts the results.

1. Retrieve the Incomplete Tasks

Use a Get Multiple Data node to retrieve the incomplete tasks related to the project.

2. Add a Rollup Node

Add a Rollup node and select Get Data Count.

3. Configure the Count

  • Data Source: Select the previous node that retrieves the incomplete tasks.

  • Limit results based on the number of summary objects: Enable this option to count only the records returned within the limit configured in the source node.

    For example, suppose 135 records match the query conditions, but the Get Multiple Data node is configured to retrieve a maximum of 100 records:

    • When enabled, the result is 100.
    • When disabled, the result is 135.

4. Use the Result

The count can be written to a record field or used in conditions to determine which workflow branch runs next.

Was this document helpful?