Iterators
In this section you will learn about Iterators
Iterators are a powerful tool in Jet Admin and can be implemented in both automation and Workflow. An iterator can cycle through a collection or an array of data and process steps individually for each item.
Iterator Use Cases
Iterators can be created in automations or workflows. You can add automation in the Automation menu on the left, and workflows can be added to components in the Actions menu of a given component.
Workflows are activated by actions and can only be edited within the Actions menu of the component they are applied to.
Automations is more general and good for purposes such as sending Slack notifications when data changes.
Use Cases in Automations
Send emails with coupons to customers who left positive/negative ratings
Create a table that updates automatically every hour with a list of active users
Keep a table updated with items that are in stock at your store or online shop
Send a Slack message to your team when important data is updated
Use Cases in Workflows
A button that will get data for the current day, analyze it with OpenAI, and save results to a table
Creating an Iterator
Add an iterator and the steps that you want to iterate over to your workflow or automation. You can also add the iterator later and drag and drop the steps into it.
Adding an Automation with Iterator
Click on the Automation icon
Click on the
Add automation
Choose a trigger for your automation or workflow
Add an iterator as a step
Iterator Settings
Iterators can work in two modes: "Load Data" and "Specify Iterate".
Load Data Type
This type of iterator will get data to iterate from any resource that you have.
You can choose a resource, a collection and use filters to get the precise data you want to cycle through.
Refer to the resources article to learn more about how resources work.
Specify Iterate Type
This type of iterator will use any array of data, that you can get from previous steps or from workflow parameters.
It could be simple arrays, or arrays of objects.
Refer to the Inputs, Outputs, Parameters article to learn more about them
Example of a Workflow with an Iterator
Let's create a button as a table header that will trigger a workflow which will iterate through a collection of customers that are filtered with a multiple select field of cities and send emails to them.
Pre-requisites
A table with data, containing a column with emails
A working filter that will be filtering the table
Gathering pre-requisites
Steps:
Have a table with a collection of items that you would want to iterate through, such as a table with customers with data for cities and their emails.
Create a component that will be used to filter out the table. Such as a multi-select with cities.
Load the data for your multi-select component dynamically from another collection, or pre-define them.
Use your multi-select component value as a filter for your table
Creating a Workflow with Iterator
Steps:
Have a table component to be used as our source of data and a filter. Such as customers table that are getting filtered by multiple cities.
Create a new action that will be performing a workflow with an iterator. One of the options is to have a button as a table header.
In the workflow builder, create a parameter to pass selected emails. It's better to use parameter with the same type as your filter on a page, which is multiple select.
Optionally add a test value to your workflow parameter with an array of at least two cites
Create an iterator that will load data from the same collection and use workflow parameter as a filter.
Create a notification inside the iterator to show current collection items email and test the workflow.
Create an action that will send the email to current collection items email.
Optionally create a delay.
Pin the button to the table as a header.
Last updated