Learn about the built-in Aggregator Tool available in Flows.
This article contains the following sections:
- What is the Aggregator Tool and what does it do?
- What challenges does the Aggregator Tool address?
- How to Access the Aggregator Tool
What is the Aggregator Tool and what does it do?
The Aggregator Tool is designed to consolidate individual elements into an array. It allows for collecting and processing data from multiple sources or entries, combining them into a cohesive output.
Whether you're compiling sales data from different regions, aggregating feedback scores, or summing up totals, the Aggregator Tool simplifies the process of consolidating information into a single data point.
Notes:
- In contrast, the Iterator Tool serves the reverse function by disaggregating the array back into its component elements. Learn more about this tool here: Iterator Tool
- The Aggregator Tool is essential for workflows where you’re mapping to systems like QuickBooks that rely on arrays for specific actions.
What challenges does the Aggregator Tool address?
The Aggregator Tool addresses common challenges like managing large datasets and manually combining multiple records. Without this tool, users might spend significant time and effort running complex queries or manually copying and pasting information into reports. With the Aggregator Tool, this process is automated, reducing human error and saving time.
Key challenges it resolves:
- Data fragmentation: Consolidates scattered data sources.
- Time inefficiency: Automates repetitive manual tasks.
- Human error: Minimizes mistakes caused by manual data entry.
In other words, the Aggregator tool helps you combine elements back into an array after performing individual updates on them. Here’s a guide on when and how to use it:
- Start with an Array of Elements
Suppose you’re working with a list of records obtained from the “Search for Multiple Records” action in a Knack Flow. This gives you an array (list) of elements, such as individual rows from a table. - Perform Additional Processing on Each Element
If you need to update each element—like performing a Table Lookup or modifying specific field values—you can use an Iterator Tool step to go through each element in the array one by one. - Combine Elements Back into a Single Array Using the Aggregator
Once your updates are complete, you’ll need to reassemble the individual elements into a single array. This is essential if the system you’re passing data to expects data in an array format. Here’s where the Aggregator tool comes in: it lets you combine all updated elements back into a single array, ready to be sent to the destination.
Example:
Using Aggregator with QuickBooks' “Create Invoice” Action
In QuickBooks, the “Create Invoice” action requires row data in an array format. You can directly map records from the “Search for Multiple Records” action if no changes are needed. But if you’ve made updates to each element (like modifying row details), you’ll need to use the Aggregator to package everything back into an array before sending it to QuickBooks.
Summary
You can use the Aggregator tool in Flows when:
- You need to use the Iterator Tool to iterate through individual elements in an array.
- You perform updates on these individual elements.
- The receiving system needs an array format, requiring you to combine elements back into a single array.
How to Access the Aggregator Tool
After selecting the Flow where you want to utilize the Aggregator Tool, identify the specific steps within the Flow that require the application of your desired conditions.
You can then add a Tool by clicking on the "+" button underneath each necessary step. Clicking the "Tool" option will allow you to select from a range of different tools Flows offers, including the Aggregator Tool.