# Looping in automations is here!

**URL:** https://air.tableforums.com/t/looping-in-automations-is-here/225
**Category:** News & Announcements
**Created:** [February 9, 2023, 1:48am UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225 "2023-02-09T01:48:05Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![ScottWorld](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/scottworld/32/5_2.png) [@ScottWorld](https://air.tableforums.com/u/ScottWorld)
#### Post date: [February 17, 2023, 1:28am UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/21 "2023-02-17T01:28:46Z")

</div>

I’m not betting against @bfrench — he hasn’t been wrong yet! 😜

---

<div class="post-metadata">

### Author: ![Karlstens](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/karlstens/32/929_2.png) [@Karlstens](https://air.tableforums.com/u/Karlstens)
#### Post date: [February 17, 2023, 2:14am UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/22 "2023-02-17T02:14:21Z")

</div>

I’ve finally noticed it pop-up in my production base for one of my clients. Had a little tinker, and taking notes from @Kuovonne’s arguments I could consider the no-code looping useful within that context. I’ll need some time to explore. It might be a case of that time where I found by simply trailing an “Update Record” action after my script, it did actually save me writing a bunch of code within my script to just push outputs into an email action (_sounds weird, but I found that the “Update Record” action has this ability to output the latest record info too_)

However, I think I’ll continue to use scripts for the bulk of my work, as I really, really enjoy writing JavaScript and solving problems with it. 🤓

Lastly, from exploring the updated no-code loop group, if anything, it reminded me about the major limitation within Automation Conditional Groups, where they don’t support nested groups for AND OR conditions (as you find within the Grid View filter). Being forced to use either AND or OR, and not being able to mix them up in sub-groups is a real pain in the 😡…

EDIT: One thing I can’t help but wonder, is that now there’s this new sub-option for either Looping or Conditional Logic, I wonder if they’ll add an area for global scripts - which in theory, could allow any automation to call the one script - which would make for easy maintenance of that segment of code that’s called by multiple automations. … imma gonna feature request. 😂

---

<div class="post-metadata">

### Author: ![AirBenderMarcus](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/airbendermarcus/32/198_2.png) [@AirBenderMarcus](https://air.tableforums.com/u/AirBenderMarcus)
#### Post date: [February 18, 2023, 7:11am UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/23 "2023-02-18T07:11:56Z")

</div>

I’ve been trying to get a list of linked records from one record to link to another in the same order. Even tried to do this with records from a view. The looping automation always links them in a random order each time. I can sort afterward with a script but that defeats the purpose of using the loop feature anyway.

So far it hasn’t improved anything I’m trying to do.

---

<div class="post-metadata">

### Author: ![ScottWorld](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/scottworld/32/5_2.png) [@ScottWorld](https://air.tableforums.com/u/ScottWorld)
#### Post date: [February 18, 2023, 1:15pm UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/24 "2023-02-18T13:15:45Z")

</div>

Yeah, unfortunately, many of Airtable’s automation actions (not just the new looping actions) will return records in a random & unpredictable order. What they really need in their automations is a “Sort Records” action.

Here’s what their [support article](https://support.airtable.com/docs/repeating-groups-of-automation-actions) says about this for looping:

> Each loop iteration is not guaranteed to run in a certain order. If your automation absolutely requires that there be a predefined order to the way that the list of records is looped through, then you’ll likely need to explore other options.

Although they don’t mention what they mean by “other options”. 😅

What they really mean is “scripting” or using an external automation tool like [Make](https://www.make.com/en?pc=scottworld). 🤷‍♂️

---

<div class="post-metadata">

### Author: ![ScottWorld](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/scottworld/32/5_2.png) [@ScottWorld](https://air.tableforums.com/u/ScottWorld)
#### Post date: [February 18, 2023, 1:19pm UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/25 "2023-02-18T13:19:19Z")

</div>

p.s. I just added this to the feature request post here:

> [@List your top Airtable feature requests here!](https://air.tableforums.com/t/pinned-list-your-top-airtable-feature-requests-here/260/8):
>
> Another feature request: Sorting records in automations: Many of Airtable’s automation actions, including the new looping actions, will return records in a random & unpredictable order. What Airtable really needs in their automations is a “Sort Records” action.

---

<div class="post-metadata">

### Author: ![ScottWorld](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/scottworld/32/5_2.png) [@ScottWorld](https://air.tableforums.com/u/ScottWorld)
#### Post date: [March 4, 2023, 9:44pm UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/26 "2023-03-04T21:44:09Z")

</div>

Here’s a nice thread on how you can use repeating groups (i.e. looping) in automations to create personalized emails for unique individuals on a schedule:

> [@Single automation to send a customized daily digest to different emails](https://air.tableforums.com/t/single-automation-to-send-a-customized-daily-digest-to-different-emails/361/):
>
> I have a table of content that gets updated to a new status and I track the date of that change in a field. This table has content for many different clients (client is a field), and I want to send each client a daily digest of the items that moved into that particular stage. A digest email for a single company is not hard, but I’m wondering if I can, in a single automation, send a daily digest of the updated content for each company to that company’s contact (their email address is also a field…

---

<div class="post-metadata">

### Author: ![Databaser](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/databaser/32/11_2.png) [@Databaser](https://air.tableforums.com/u/Databaser)
#### Post date: [March 6, 2023, 10:10am UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/27 "2023-03-06T10:10:43Z")

</div>

Am I missing something? I can’t limit a “grid” or “list” from a “find records” action to the different values of the used “input list”?

eg: find records where “status” = to do; loop based on “owner”; send grid of records that are only tied to that owner? In the “current item” option, I can’t add a “list” or “grid”? So it does email everyone separately, but showing every record from the “find records” action.

---

<div class="post-metadata">

### Author: ![ScottWorld](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/scottworld/32/5_2.png) [@ScottWorld](https://air.tableforums.com/u/ScottWorld)
#### Post date: [March 6, 2023, 11:53am UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/28 "2023-03-06T11:53:45Z")

</div>

It’s pretty unintuitive. You would have to do yet another “find records” step within the repeating/looping section of your automation that performs a find for the specific records you’re looking for.

(Unlike [Make.com](https://www.make.com/en?pc=scottworld)’s automations, this won’t create another loop… it just gives you the chance to grab a list of the records you want.)

Back in your database, you’ll probably need to create formula fields and lookup fields (possibly resulting in the Record ID) that let you do the proper searches in your automations.

---

<div class="post-metadata">

### Author: ![bfrench](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/bfrench/32/46_2.png) [@bfrench](https://air.tableforums.com/u/bfrench)
#### Post date: [March 10, 2023, 12:40pm UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/29 "2023-03-10T12:40:07Z")

</div>

> [@ScottWorld](#):
>
> You would have to do yet another “find records” step within the repeating/looping section of your automation

And there lay the key design flaw in this new looping feature. The pervasive use of this feature will serve convenience well and disserve performance.

Airtable engineers should have tackled this challenge with a collection of automation components - one is a grid extraction (aka, a hash index) that would serve as a blistering fast approach to mitigate nested looping altogether.

---

<div class="post-metadata">

### Author: ![bfrench](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/bfrench/32/46_2.png) [@bfrench](https://air.tableforums.com/u/bfrench)
#### Post date: [March 10, 2023, 12:41pm UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/30 "2023-03-10T12:41:15Z")

</div>

> [@ScottWorld](#):
>
> this won’t create another loop… it just gives you the chance to grab a list of the records you want.

Note to self: I just liked a Make feature. Book an extra session with my shrink.

---

<div class="post-metadata">

### Author: ![Kuovonne](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/kuovonne/32/17_2.png) [@Kuovonne](https://air.tableforums.com/u/Kuovonne)
#### Post date: [March 11, 2023, 12:44am UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/31 "2023-03-11T00:44:11Z")

</div>

> [@bfrench](#):
>
> And there lay the key design flaw in this new looping feature. The pervasive use of this feature will serve convenience well and disserve performance.

Currently Airtable automations can have only one no-code loop. Thus a no-code automation is limited to one level of loop nesting. I wonder if that is part of their attempt to manage performance issues.

---

<div class="post-metadata">

### Author: ![bfrench](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/bfrench/32/46_2.png) [@bfrench](https://air.tableforums.com/u/bfrench)
#### Post date: [March 11, 2023, 1:09am UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/32 "2023-03-11T01:09:10Z")

</div>

> [@Kuovonne](#):
>
> I wonder if that is part of their attempt to manage performance issues.

I think it is. But more accurate to say:

A nested loop is a really poor design pattern; there shouldn’t be any nesting at all. You and I have proven this many times in script.

---

<div class="post-metadata">

### Author: ![Kuovonne](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/kuovonne/32/17_2.png) [@Kuovonne](https://air.tableforums.com/u/Kuovonne)
#### Post date: [March 11, 2023, 7:22am UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/33 "2023-03-11T07:22:24Z")

</div>

> [@bfrench](#):
>
> A nested loop is a really poor design pattern

A nested loop is one of several design patterns and it is easier for many emerging developers to understand than the more efficient design patterns. As such, I think it has a place in the world.

But this is also where I think Make has a better pricing strategy. Make charges per operation so more complex scenario cost the user more. If the user chooses to use an inefficient design pattern, they pay the price for it.

On the other hand, Airtable only charges a flat rate per automation trigger. If I’m reading the documentation correctly, you could then run an automation that runs a complex 30 second script over 150,000 times for the cost of a single automation run. I’m probably reading the documentation wrong.

---

<div class="post-metadata">

### Author: ![bfrench](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/bfrench/32/46_2.png) [@bfrench](https://air.tableforums.com/u/bfrench)
#### Post date: [March 11, 2023, 10:29pm UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/34 "2023-03-11T22:29:52Z")

</div>

> [@Kuovonne](#):
>
> an automation that runs a complex 30 second script over 150,000 times for the cost of a single automation run. I’m probably reading the documentation wrong.

I think you’re interpreting the docs just fine. But, a variable (perhaps inefficient) process that must run in the constraint of 30 seconds is difficult to predict. Airtable scale, this approach will almost certainly break, right?

---

<div class="post-metadata">

### Author: ![Kuovonne](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/kuovonne/32/17_2.png) [@Kuovonne](https://air.tableforums.com/u/Kuovonne)
#### Post date: [March 12, 2023, 4:57pm UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/35 "2023-03-12T16:57:12Z")

</div>

> [@bfrench](#):
>
> I think you’re interpreting the docs just fine.

Thanks.

> [@bfrench](#):
>
> this approach will almost certainly break, right?

I’m pretty sure the automation that I described would fail. It is an extreme case to illustrate a point, not a reasonable automation. But I don’t know what the actual limit is or should be. And I wonder what will happen when people bump up against undocumented but realistic limits.

---

<div class="post-metadata">

### Author: ![bfrench](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/bfrench/32/46_2.png) [@bfrench](https://air.tableforums.com/u/bfrench)
#### Post date: [March 12, 2023, 9:50pm UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/36 "2023-03-12T21:50:41Z")

</div>

> [@Kuovonne](#):
>
> I wonder what will happen when people bump up against undocumented but realistic limits.

Confusion. Dismay. Support calls.

---

<div class="post-metadata">

### Author: ![RussellBishop](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/russellbishop/32/972_2.png) [@RussellBishop](https://air.tableforums.com/u/RussellBishop)
#### Post date: [March 25, 2023, 9:54pm UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/37 "2023-03-25T21:54:20Z")

</div>

Just to add to this, I think you would probably initially do a find on your Users, then loop on those Users, and do a find records for their Tasks (status = to do") within your loop.

---

<div class="post-metadata">

### Author: ![bfrench](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/bfrench/32/46_2.png) [@bfrench](https://air.tableforums.com/u/bfrench)
#### Post date: [March 25, 2023, 10:48pm UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/38 "2023-03-25T22:48:53Z")

</div>

> [@RussellBishop](#):
>
> then loop on those Users, and do a find records for their Tasks (status = to do") within your loop.

But, circling back to the issue - nested loops (without the benefit of a hash index) are performance hogs. If the data sets are small, this works just dandy. But as the task data grows, the performance will always be in a state of increasing decline, and such decline is non-linear. It won’t scale.

You need a hash index of tasks so that they are traversed one time and all lookups are by memory pointers (i.e., user IDs that reveal in \< 10ms all the tasks for that user).

---

<div class="post-metadata">

### Author: ![Kuovonne](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/kuovonne/32/17_2.png) [@Kuovonne](https://air.tableforums.com/u/Kuovonne)
#### Post date: [March 25, 2023, 11:42pm UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/39 "2023-03-25T23:42:21Z")

</div>

> [@bfrench](#):
>
> circling back to the issue - nested loops (without the benefit of a hash index) are performance hogs.

I agree that a hash index is better. But what is a no-code Airtable creator realistically able to do about this?

I think this is an issue for Airtable to solve. Or perhaps they have already decided to take the performance hit (at least for now).

---

<div class="post-metadata">

### Author: ![bfrench](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/bfrench/32/46_2.png) [@bfrench](https://air.tableforums.com/u/bfrench)
#### Post date: [March 26, 2023, 12:16am UTC](https://air.tableforums.com/t/looping-in-automations-is-here/225/40 "2023-03-26T00:16:31Z")

</div>

> [@Kuovonne](#):
>
> Or perhaps they have already decided to take the performance hit (at least for now).

Unfortunately, it is not Airtable who takes the hit; it is users who feel this. Airtable’s own servers are insulated from their poorly-designed features.

[Previous page](https://air.tableforums.com/t/looping-in-automations-is-here/225.md?page=1)
