Key concepts
Tools

Aggregator

4min
an aggregator is a types of modules docid\ pdopibceckcbomppkplmy designed to merge several bundles of data into a single bundle when an aggregator is executed, it accumulates all the bundles it receives (during a single source module's operation) outputs a single bundle with an array containing one item per each accumulated bundle the content of the array's items depends on particular aggregator module and its setup a typical example of an aggregator module is the flow control docid\ ncszyp3n o5a3r4cuqcel module aggregators usually feature the following fields source module the module from which the bundle aggregation will start the source module is usually an flow control docid\ ncszyp3n o5a3r4cuqcel or a search module that outputs a series of bundles once you setup the aggregator's source module (and close the aggregator's setup), the route between the source module and the aggregator will be wrapped in a grey area to visualize the start and the end of the aggregation searches group by the aggregator's output can be split into several groups with the help of the group by field the group by field can contain a formula that is evaluated for each aggregator's input bundle the aggregator then outputs one bundle per each distinct formula's value each bundle contains two items key contains the distinct value array contains the aggregated data from the bundles for which the formula evaluated to the key value stop processing after an empty aggregation by default, the aggregator outputs the result of the aggregation even in case no bundles reached the aggregator (e g because they have been all filtered out on their way) if the stop processing after an empty aggregation option is enabled, the aggregator will not produce any output bundle in this case and the flow will stop bundles outputted from the source module and any other modules between the source module and the aggregator module are not outputted by the aggregator and thus items in these bundles are not accessible by the modules in the flow after the aggregator if you need to access items from bundles outputted from the source module and any other modules between the source module and the aggregator module, make sure to include them in the aggregator's setup, e g in the aggregated fields field in the setup of the array aggregator module example use case zipping all email attachments and uploading the zip file to dropbox the {{scenario singular lowercase}} below shows how to watch a mailbox for incoming emails docid\ h5qycydcfm29tfymovn0n trigger will output a bundle with item attachments\[] , which is an array containing all the email's attachments iterate the email's attachments docid\ h5qycydcfm29tfymovn0n iterator takes the items from the attachments\[] array one by one and sends them further as separate bundles aggregate the bundles outputted by the docid\ h5qycydcfm29tfymovn0n module docid\ c133rb5j6ddfp4 4qka4w aggregator accumulates all the bundles it receives and outputs a single bundle containing the zip file upload the resulting zip file to dropbox dropbox > upload a file obtains the zip file from the docid\ c133rb5j6ddfp4 4qka4w module and uploads it to dropbox below is a sample setup of the archive > create an archive aggregator