Skip to main content

Roll up collected records action

Use a rollup to turn a collected list into one value, for example count open tasks or add up unpaid invoices, and reuse it in later actions.

Written by Leo

Rollup collected is an action that calculates one value from a field of all collected records, for example a count or a total. In the action list, its description reads Rollup values from collected records. It's meant to help you summarize many records without a loop or a script, and to save the result in a variable for later steps.

You can use this action for many things, including:

  • Counting the open tasks of a project and writing the number into an email.

  • Adding up the amounts of all unpaid invoices and saving the total on the customer's record.

Rollup collected action in the automation editor with a field, a calculation, and an output name

Note:

  • Collect first. The action needs a collection created by an earlier action, such as Search for records, Get view, or Get related. Without one, Select a field shows No results.

  • Each collecting action returns up to 1,000 records. If more records match, the result is cut to the first 1,000 without a warning. The rollup covers every record in the list.

  • The result is a variable, not a field. To keep it, use it in a later action such as Update record.

Who can use the Rollup collected action?

  • Automations are available on the Free, Plus, and Premium plans. The number of automation actions per month depends on your plan. See the limits for your plan on our pricing page.

  • To add or change this action, you need to be a workspace admin of the workspace the database app is in. You also need full access to every database the automation uses.

Add the Rollup collected action

To roll up values from collected records:

  1. Open the database app and click the automations icon at the top right (Create and view automations).

  2. Open an automation, or select New automation and choose a trigger.

  3. Add an action that collects records, for example Add action → Search for records.

  4. Select Add action → Rollup collected. The step appears as Rollup collected values.

  5. Check the field of the collected records to calculate from. Tape preselects a field of the nearest collection above this action. Select its name to choose another field. Without a collection, it reads Select a field.

  6. Select the calculation next to calculate. It starts as Count all.

  7. Select the name next to and save in, and rename it if you want to find the result later. It starts as Rollup.

  8. Select Save changes. For a new automation, the button reads Create automation.

Adding Search for records and then Rollup collected in an Expenses automation: changing the preselected field Expense to Amount, the calculation Count all to Sum, and the name after and save in from Rollup to Total amount

Rollup collected settings

The action reads as a sentence: Rollup collected values from a field, calculate a calculation, and save in a variable.

  • Select a field: the field of the collected records that the rollup reads. The list shows fields of the collections created by actions above this one. Without a field, the action is skipped.

  • calculate: the calculation. Select it to open the list. For every field, you can choose:

  • Count all counts all collected records.

  • Count empty counts the records where the field is empty.

  • Count not empty counts the records where the field has a value.

  • Percent empty shows the share of records where the field is empty.

  • Percent not empty shows the share of records where the field has a value.

  • Number calculations: for number fields, and calculation fields that return a number, you can also choose Sum, Average, Median, Min, and Max.

  • and save in: the name of the variable that holds the result. The default name is Rollup. Give it a clear name, such as "Total unpaid", when you use more than one rollup. Insert the variable in later actions by typing @. When you rename it, the variable name changes with it. In scripts, Total unpaid becomes var_total_unpaid.

The result is one value for the whole collection. A rollup doesn't change the collection or your records.

Let's look at an example

Let's say your finance team wants every customer to get a summary of unpaid invoices when a statement is sent. Here's how:

  1. Set the trigger to When a record is updated in the database app Customers and select the field Statement.

  2. Add the filter Where Statement Has changed to "Send".

  3. Select Add action → Search for records, select the database Invoices, and add filters so only unpaid invoices of this customer are collected.

  4. Select Add action → Rollup collected.

  5. Select the preselected field and choose Amount, set the calculation to Sum, and rename the output to "Total unpaid".

  6. Select Add action → Update record and insert the Total unpaid variable into the field Open balance on the customer.

  7. Select Save changes.

When a statement is sent, the customer's Open balance shows the total of all unpaid invoices. If you only want the number of unpaid invoices, use Count all instead.

Rollup collected errors

  • If the step fails, the run shows the step and its message in the automation's runs. Open the automation and select ▷ next to Manual run (View all runs, cmd/ctrl + 1). Each run shows its status, for example Success; select a run to see every step. For all automations, open Runs in the Automation Center and filter by App, Automation, or Status.

  • If Select a field shows No results, add a collecting action above this one.

  • If the field you select has no values, Count empty still gives a result. For an empty list, Sum and the counts return 0. Average, Median, Min, and Max return an empty value.

Test, pause, or edit the Rollup collected action

  • Manual run runs the automation once. It appears after the automation is saved. Under Run on, select the records, then select Start run (Save and start run if you have unsaved changes). Actions that use the result, such as updates or emails, work on real records.

  • New automations you create in the editor are Active right away. The status, Active or Paused, sits below the automation's name in the editor. To pause one, select the status to switch it to Paused, then select Save changes.

  • To change the action, open the automation, select the Rollup collected values step, make your changes, then select Save changes.

  • The action's menu has Settings, Continue on error, Deactivate, Turn into, Duplicate, and Remove. Learn more about action settings →

Learn more

FAQs

Do I need a loop to add up values?

No. Rollup collected calculates the value over the whole collection in one step. Use a loop only when each record needs its own steps. Learn more about loops →

Can I add up amounts?

Yes! Select the number field, then select Sum. It's available for number fields and calculation fields that return a number.

How do I use the result?

Type @ in a later action and select the variable you named next to and save in. You can write it into a field with Update record, add it to a comment, or put it into an email.

Can I roll up records that aren't related to the current record?

Yes. The rollup covers whatever your collecting action returns, for example all records of a database app that match a filter. To limit it to related records, use Get related to collect them.

Is there a limit for the number of records?

Yes. A collecting action returns up to 1,000 records. Learn more about limits →

Are there other actions I can use?

Yes! Actions can create and update records, add comments, send emails, create PDFs, call other services, and more. See every action in Automation actions →

Are you a developer using the Tape API for automations?

The automation API has its own documentation for developers. Full reference: rollup_iterable_values in the developer docs →

Still have questions? Find answers and get help from community experts in the Tape community →

Did this answer your question?