Iterators are a powerful tool in Jet Admin, and they can be implemented in both Automations and Workflows. Here are some example use cases for an iterator:
- 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
Iterators can be created in automations or workflows. You can add automations in the Automations menu on the left, and workflows can be added to components in the Actions menu of a given component. Remember, workflows are activated as actions and can only be edited within the Actions menu of the component they are applied to, whereas automations are more general and good for purposes like sending Slack notifications when data changes.
Once you've clicked Add automation in the Automations menu or chosen to add a Run workflow action to a component, you will see the automation builder. Choose a trigger for your automation or workflow.
Add an iterator and the steps that you want to iterate over to your automation. You can also add the iterator in later and drag and drop the steps into it.
For this specific example, it is necessary to create empty tables (with the fields that you want) in Jet Tables that records can then be added to.
- 1.This automation is run manually, meaning that to run it, it's necessary to go to the automations menu and select Run automation.
- 2.The Xano table is accessed using Get Record List, which the Iterator will then iterate over.
- 3.The iterator begins, using Operation Result from Run Operation - Xano.
- 4.One record of the Market Sales table is selected, then the Yes/No function sorts it. In this example, Yes is if the customer left a rating of higher than or equal to 5, and No is if the rating is lower than 5. Note: If you do not see the Iterator in the menu of steps, click Test Automation, and then try again.
- 5.If the user has left a rating of more than 5/10, certain info from the record is added to the table with the information from higher-rated transactions. If not, that info is added to the other table, with the information from lower-rated transactions. In this example, a label of high rating/low rating has also been included, but in this case it is chosen by the user when setting up the automation. Note: As before, if certain options are not available in the menu, click Test Automation and try again.
- 6.Iterator moves on to next record.
Once you've completed your automation, be sure to click save it!