Explore more
Tools

Flow control

16min
repeater a repeater is used in cases where you wish to repeat a task a set number of times for example, if you would like to send five emails with subjects "hello 1", "hello 2", "hello 5", this could be accomplished with connecting the email > send an email module after the repeater module module configuration details repeater configuration email module con you can imagine the repeater module as a generator of bundles outputting one bundle after another each bundle contains one item named i of type number the initial value of the i item is specified in the initial value field the number of repetitions (= number of bundles) is specified in the repeats field the value of the i item is increased in each repetition by the value specified in the step field, which is 1 by default (toggle the show advanced settings box to reveal it) iterator an iterator is a special type of module that converts an array into a series of bundles each array item will output as a separate bundle setting up an iterator setting up an iterator is done in the same way as module settings docid\ vnbss belmdin3d4gguxl the array field contains the array to be converted/split into separate bundles in this example, the {{scenario singular lowercase}} below shows how to retrieve emails with attachments and save the attachments as single files in a selected google drive folder save email attachments to google drive emails can contain an array of attachments the iterator module inserted after the first module enables you to handle each attachment separately the iterator splits the array of attachments into single bundles, each bundle with one attachment will then save one at a time in a selected google drive folder the array field should contain the attachments\[] array specialized iterators for your convenience, many {{product name}} apps offer specialized iterator modules with a simplified setup for example, the email app contains the special iterator iterate attachments that will produce the same results as the general iterator module without having to specify the array, just the source module specialized iterators when to use an iterator in your scenario the video below is module one of the three part lesson titled iterator and array aggregator it explains the purpose of the iterator and the array aggregator and with the help of a sample {{scenario singular lowercase}} , when to use an iterator, and what to do with the output youtube link here https //www youtube com/embed/mwzba2xsvb4 mappable items under the iterator module when an iterator does not have information about the structure of the array's items, the mapping panel in the modules following the iterator will display only two items under the iterator total number of bundles and bundle order position mappable items the reason for this is that in {{product name}} , each module is responsible for providing information about items it outputs so these items can be properly displayed in the mapping panel in the following modules however, there are several modules that might be unable to provide this information in some cases, e g json > parse json or webhooks > custom webhook modules with missing data structures docid 1eokqdvoyet82um5djja8 the solution is to manually execute the {{scenario singular lowercase}} to make the module learn about the items it outputs so it can provide the information to the following modules for example, if you have a json > parse json module without a data structure and then you connect an iterator module to it, you will not be able to map the output of the module to the array field in the setup panel of the iterator json without a data structure to resolve this, manually start the {{scenario singular lowercase}} in the {{scenario singular lowercase}} editor you can un link the modules after the json > parse json module to prevent the flow from proceeding further or right click the json > parse json module and choose run this module only from the context menu to execute only the json > parse json module once the json > parse json has been executed, it learns about the items it outputs and provides this information to all the following modules including the iterator the mapping panel in the iterator's setup will then display the items json module with mappable items the mapping panel in the modules connected after the iterator will display the items contained in the array's items mapping module in the iterator if you cannot see some items in a module's mapping panel, simply run the {{scenario singular lowercase}} once so all the modules can learn about the items they output and provide this information to the following modules array aggregator an array aggregator is an aggregator module that allows you to merge several bundles into one single bundle the following image shows a typical setup of the array aggregator module field description source module the module from which the bundle aggregation will start the source module is usually an iterator 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 target structure type the target structure into which the data shall be aggregated the default option is custom that enables you to choose items that should be aggregated into the array aggregator's output bundle's array item once you connect more modules after the array aggregator module and get back to the module's setup, the target structure type dropdown will contain all the following modules and their fields that are of type array of collections, like e g attachments field of the slack > create a message module 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 output from the source module and any other modules between the source module and the aggregator module are not output 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 output from the source module and any other modules between the source module and the aggregator module, make sure to include them in the aggregated fields field in the setup of the array aggregator module if items are nested (i e contained in a collection item) they currently cannot be easily selected in the array aggregator's aggregated fields field for example, if bundles contain collection item user with two items name and email then only the user collection item can be selected this setup will produce the following output customize the output if you wish to fully customize the array aggregator 's output structure insert the json > create json module after the array aggregator module open the json > create json module's setup setup a data structure for the items you want to be output from the array aggregator the data structure should be an array of collections and the collections should contain the items you want to include in the output here is a sample data structure with two text items name and email open the array aggregator module's setup in the target structure type field, choose the json > create json module's array field fields corresponding to the data structure created in step 3 will appear in the setup of the array aggregator module map any items into the fields you can now easily map nested items using the mapping panel and even use formulas map items into the fields the array aggregator module's output will now look like this if you wish to save the operation performed by the json > create json module, put it on a disabled route after a router save json module on a disabled router if you wish to conditionally omit an item from the module's output, use a formula that evaluates to ignore keyword if the 4 user email is empty then the email item will be completely omitted from the output when to use an array aggregator in your scenarios how modules connected after an array aggregator affects the target structure type dropdown